I can see the product with different options
This commit is contained in:
@@ -60,6 +60,19 @@
|
||||
|
||||
<template x-if="current">
|
||||
<div class="space-y-6">
|
||||
<!-- option picker (only when there's a real choice); first option is
|
||||
selected by default and switching it updates the price + buy form -->
|
||||
<template x-if="variants.length > 1">
|
||||
<div class="max-w-sm space-y-1.5">
|
||||
<label for="variant-select" class="text-sm font-medium text-on-surface-strong dark:text-on-surface-dark-strong">{{ t(key="choose-option", lang=lang | default(value='sk')) }}</label>
|
||||
<select id="variant-select" x-model.number="sel" class="{{ fld }}">
|
||||
<template x-for="(v, i) in variants" :key="v.id">
|
||||
<option :value="i" x-text="(v.label || '—') + ' · ' + v.price + ' {{ product.currency }}' + (v.in_stock ? '' : ' ({{ t(key='out-of-stock', lang=lang | default(value='sk')) }})')"></option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="flex items-baseline gap-3">
|
||||
<p class="text-2xl font-semibold" :class="current.on_sale ? 'text-danger' : 'text-primary dark:text-primary-dark'">
|
||||
<span x-text="current.price"></span> {{ product.currency }}
|
||||
@@ -73,18 +86,6 @@
|
||||
<div class="whitespace-pre-line leading-relaxed text-on-surface/80 dark:text-on-surface-dark/80">{{ product.description }}</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- variant picker (only when there's a real choice) -->
|
||||
<template x-if="variants.length > 1">
|
||||
<div class="max-w-sm space-y-1.5">
|
||||
<label for="variant-select" class="text-sm font-medium text-on-surface-strong dark:text-on-surface-dark-strong">{{ t(key="choose-option", lang=lang | default(value='sk')) }}</label>
|
||||
<select id="variant-select" x-model.number="sel" class="{{ fld }}">
|
||||
<template x-for="(v, i) in variants" :key="v.id">
|
||||
<option :value="i" x-text="(v.label || '—') + ' · ' + v.price + ' {{ product.currency }}' + (v.in_stock ? '' : ' ({{ t(key='out-of-stock', lang=lang | default(value='sk')) }})')"></option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template x-if="current.in_stock">
|
||||
<div class="space-y-2">
|
||||
<form method="post" action="/cart/add" hx-post="/cart/add" hx-swap="none" class="flex flex-wrap items-end gap-3"
|
||||
|
||||
Reference in New Issue
Block a user