Lorem ipsum

Sedačka script

<!-- https://chatgpt.com/share/6819c084-9b68-8008-bde0-474f5afe4711 -->
<script>
$(document).ready(function () {
const table = $(".detail-parameters tbody");

// Insert section headers
table.find("tr:has(th:contains('Typ područky'))").first().before(`
<tr><td colspan="2"><strong>1) Nejdříve vyberte područku</strong></td></tr>
`);
table.find("tr:has(th:contains('Orientace'))").first().before(`
<tr><td colspan="2"><strong>2) Nyní vyberte orientaci pohovky</strong></td></tr>
`);

const fabricRow = table.find("tr:has(th:contains('Potahová látka'))").first();
fabricRow.before(`
<tr><td colspan="2"><strong>3) Nyní vyberte vzorník</strong></td></tr>
<tr id="swatchRow">
<td colspan="2">
<div id="swatchSelector">
<label style="cursor:pointer;">
<input type="radio" name="swatchGroup" value="Primo" style="display:none;">
<img src="https://www.bekrnabytek.cz/_obchody/bekrnabytek.web5.cz/prilohy/66/sk-1-primo-wr-davis-4.jpg" alt="Primo" style="width:100px; border:2px solid transparent;">
Primo
</label>
<label style="cursor:pointer;">
<input type="radio" name="swatchGroup" value="Solid" style="display:none;">
<img src="https://www.bekrnabytek.cz/_obchody/bekrnabytek.web5.cz/prilohy/66/sk-1-solid-wr-2.png" alt="Solid" style="width:100px; border:2px solid transparent;">
Solid
</label>
<label style="cursor:pointer;">
<input type="radio" name="swatchGroup" value="Sun" style="display:none;">
<img src="https://www.bekrnabytek.cz/_obchody/bekrnabytek.web5.cz/prilohy/39/sk-2-sun.jpg" alt="Sun" style="width:100px; border:2px solid transparent;">
Sun
</label>
</div>
</td>
</tr>
`);

fabricRow.before(`
<tr><td colspan="2"><strong>4) Nyní vyberte konkrétní látku</strong></td></tr>
`);

// Handle swatch click to filter options
$("#swatchSelector input[type=radio]").on("change", function () {
const selectedGroup = $(this).val();

// Highlight selected image
$("#swatchSelector img").css("border", "2px solid transparent");
$(this).next("img").css("border", "2px solid black");

// Show/hide fabric labels based on selection
$("#parameter-id-108 label.advanced-parameter").each(function () {
const text = $(this).find(".parameter-value").text();
if (text.includes(selectedGroup)) {
$(this).show();
} else {
$(this).hide();
}
});

$("#swatchRow").addClass("variant-selected");
});

// Show only relevant swatch buttons based on actual fabric options
function updateSwatchesVisibility() {
const fabricLabels = $("#parameter-id-108 .advanced-parameter-inner");

const optionTexts = fabricLabels.map(function () {
return $(this).attr("title") || $(this).attr("data-testid") || "";
}).get();

$("#swatchSelector label").each(function () {
const groupName = $(this).text().trim();
const matchFound = optionTexts.some(text => text.includes(groupName));
$(this).toggle(matchFound);
});
}

updateSwatchesVisibility();
});
</script>