<!-- SKRYTÍ SLEVY 5 % – pouze vizuálně, funkčnost ponechána --><style>/* Schovat tlačítko 'Zavřít' pod kalkulátorem */button[onclick="closeDeliveryAddressModal()"] { display: none !important; }#prepaymentDiscountCheckbox,label[for="prepaymentDiscountCheckbox"],#prepaymentDiscountCheckbox-90x13,label[for="prepaymentDiscountCheckbox-90x13"],#prepaymentDiscountCheckbox-150x12,label[for="prepaymentDiscountCheckbox-150x12"] {display: none !important;}</style><!--DŮLEŽITÉ PRO EMAILJS ŠABLONY:Aby se HTML (rekapitulace, vstupní tabulka, kalkulace) nerenderovalo jako prostý text,použijte v EmailJS šablonách TROJITÉ složené závorky:{{{summary_html}}}{{{entry_table_html}}}{{{calculation_html}}}Upravte to v admin i zákaznické šabloně.--><style>.clickable-pickup { cursor: pointer; }.clickable-pickup:hover { text-decoration: underline; }</style><style>/* --- STYLY PRO MODÁLNÍ OKNO OBJEDNÁVKY --- */.modal-overlay {position: fixed;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, 0.5);display: none; /* Skryto defaultně */justify-content: center;align-items: flex-start;z-index: 2000;opacity: 0;transition: opacity 0.3s ease;overflow-y: auto;}.modal-overlay.open {display: flex;opacity: 1;}.modal-content-slide {background-color: #fff;padding: 2.5rem;border-radius: 0 0 16px 16px;box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);width: 95%;max-width: 800px;margin-top: 50px;transform: translateY(-100vh);opacity: 0;transition: transform 0.4s ease-out, opacity 0.4s ease-out;max-height: calc(100vh - 100px);overflow-y: auto;}.modal-overlay.open .modal-content-slide {transform: translateY(0);opacity: 1;}/* --- KONEC STYLŮ MODÁLU --- */.company-fields-animated {transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, padding 0.4s ease-in-out;max-height: 0;opacity: 0;overflow: hidden;padding-top: 0 !important;padding-bottom: 0 !important;}.company-fields-animated.open {max-height: 800px;opacity: 1;padding-top: 1rem !important;padding-bottom: 1rem !important;}.delivery-fields-inner-animated {transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, margin 0.4s ease-in-out;max-height: 0;opacity: 0;overflow: hidden;margin-top: 0 !important;margin-bottom: 0 !important;}.delivery-fields-inner-animated.open {max-height: 500px;opacity: 1;margin-top: 1rem !important;margin-bottom: 1rem !important;}/* Message box used by showMessage() */.message-box {position: fixed;bottom: 20px;left: 50%;transform: translateX(-50%);background-color: #22c55e;color: white;padding: 1rem 2rem;border-radius: 10px;box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);z-index: 3000;opacity: 0;transition: opacity 0.5s ease-in-out;}/* jednotný vzhled všech tlačítek */.calculate-button,.highlighted-button,#terraceSaveToPdfButton,#fence90x13SaveToPdfButton,#fence150x12SaveToPdfButton {font-family: 'Inter', sans-serif;background-image: linear-gradient(0deg, var(--lw-green) 0%, #ffffff 100%);color: #0b3d0b;border: 1px solid rgba(106,170,61,0.25);transition: transform .2s, box-shadow .2s, background-position .3s;background-size: 100% 200%;background-position: 0% 100%;}.calculate-button:hover,.highlighted-button:hover,#terraceSaveToPdfButton:hover,#fence90x13SaveToPdfButton:hover,#fence150x12SaveToPdfButton:hover {background-image: linear-gradient(0deg, var(--lw-green-2) 0%, #ffffff 100%);transform: translateY(-1px);box-shadow: 0 6px 16px rgba(106,170,61,0.25);background-position: 0% 0%;}</style><link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" crossorigin=""><script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" crossorigin="">'use strict';</script><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Kalkulátor WPC</title><script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script><script src="https://cdn.tailwindcss.com"></script><style>@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');:root{/* Lambowood brand – uprav podle manuálu, pokud máš přesné HEX */--lw-green: #6AAA3D;--lw-green-2: #8CCB4A; /* pro hover */}body { font-family: 'Inter', sans-serif; background-color: #f7fafc; }.container { max-width: 1000px; margin: 0 auto; padding: 2rem; }.card { background-color: #ffffff; border-radius: 12px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05); padding: 2rem; }/* sjednocený brand vzhled pro všechna NE-PDF tlačítka (vč. navigace) */.nav-link-box,.calculate-button,.highlighted-button {font-family: 'Inter', sans-serif;/*⬇️přechod zdola nahoru */background-image: linear-gradient(0deg, var(--lw-green) 0%, #ffffff 100%);color: #0b3d0b;border: 1px solid rgba(106,170,61,0.25);transition: transform .2s, box-shadow .2s, background-position .3s;background-size: 100% 200%;background-position: 0% 100%; /* start – zelená dole */}.nav-link-box:hover,.calculate-button:hover,.highlighted-button:hover {/*⬇️hover varianta, taky zdola nahoru */background-image: linear-gradient(0deg, var(--lw-green-2) 0%, #ffffff 100%);transform: translateY(-1px);box-shadow: 0 6px 16px rgba(106,170,61,0.25);background-position: 0% 0%; /* animace posunu nahoru */}/* aktivní záložka */.nav-link-box.active-link {background-image: none;background-color: var(--lw-green);color: #ffffff;border-color: transparent;box-shadow: 0 6px 14px rgba(106,170,61,0.28);}/* PDF tlačítka ponechána modrá */#terraceSaveToPdfButton,#fence90x13SaveToPdfButton,#fence150x12SaveToPdfButton {background-color: #2563eb; /* Tailwind blue-600 */color: #ffffff;transition: background-color .2s, box-shadow .2s;}#terraceSaveToPdfButton:hover,#fence90x13SaveToPdfButton:hover,#fence150x12SaveToPdfButton:hover {background-color: #1d4ed8; /* blue-700 */box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }.hint { font-size: 12px; color: #6b7280; }/* jednotný vzhled všech tlačítek */.calculate-button,.highlighted-button,#terraceSaveToPdfButton,#fence90x13SaveToPdfButton,#fence150x12SaveToPdfButton {font-family: 'Inter', sans-serif;background-image: linear-gradient(0deg, var(--lw-green) 0%, #ffffff 100%);color: #0b3d0b;border: 1px solid rgba(106,170,61,0.25);transition: transform .2s, box-shadow .2s, background-position .3s;background-size: 100% 200%;background-position: 0% 100%;}.calculate-button:hover,.highlighted-button:hover,#terraceSaveToPdfButton:hover,#fence90x13SaveToPdfButton:hover,#fence150x12SaveToPdfButton:hover {background-image: linear-gradient(0deg, var(--lw-green-2) 0%, #ffffff 100%);transform: translateY(-1px);box-shadow: 0 6px 16px rgba(106,170,61,0.25);background-position: 0% 0%;}</style><div class="container py-8 px-4"><div class="card"><nav class="mb-8"><ul class="flex flex-col md:flex-row justify-around text-center font-semibold space-y-2 md:space-y-0"><li><a class="nav-link-box inline-block p-2 rounded-lg" data-target="terrace-calculator">Kalkulátor teras</a></li><li><a class="nav-link-box inline-block p-2 rounded-lg" data-target="fence-90x13-calculator">Kalkulátor plotových profilů 90x13 mm</a></li><li><a class="nav-link-box inline-block p-2 rounded-lg" data-target="fence-150x12-calculator">Kalkulátor plotových profilů 150x12 mm</a></li></ul></nav><!-- TERASA --><div id="terrace-calculator"><h1 class="text-3xl font-bold text-center text-gray-900 mb-6">Orientační cenová kalkulace terasy</h1><p class="text-center text-gray-600 mb-8">Zadejte prosím parametry terasy pro výpočet orientační ceny.</p><div class="bg-blue-50 p-4 rounded-lg border-l-4 border-blue-600 mb-6"><p class="text-blue-800 font-semibold">Před objednáním si zkontrolujte dostupnost materiálu <a href="https://drive.google.com/file/d/14ysyAVzcd852sDX1GcnUqTGFJEvCUPOm/view" target="_blank" rel="noopener" class="underline text-blue-800">zde</a>.</p></div><!-- E‑MAIL (povinné)–terasy --><!-- E‑MAIL (povinné)–styl sjednocenýs ostatnímiřádky --><div class="flex flex-col md:flex-row items-center justify-between bg-gray-50 p-4 rounded-lg mb-2"><label for="userEmailTerrace" class="text-sm font-medium text-gray-900 w-full md:w-1/2">E‑mail (povinné)</label><input type="email" id="userEmailTerrace" data-email-required="" class="mt-1 block w-full md:w-1/2 px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none" placeholder="např. jan.novak@email.cz"></div><p class="text-xs text-gray-500 mb-6">Bez vyplněného e‑mailu nenímožnéspočítat kalkulaci.</p><form id="calculatorForm"><div class="space-y-6"><div class="flex flex-col md:flex-row items-center justify-between bg-gray-50 p-4 rounded-lg"><label for="vymera" class="text-sm font-medium text-gray-900 w-full md:w-1/2">Výměra terasy v m²</label><input type="number" id="vymera" min="0" step="0.01" value="0" class="mt-1 block w-full md:w-1/2 px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none"></div><div class="flex flex-col md:flex-row items-center justify-between bg-gray-50 p-4 rounded-lg"><label for="obvod" class="text-sm font-medium text-gray-900 w-full md:w-1/2">Výměra obvodu terasy k lištování v bm</label><input type="number" id="obvod" min="0" step="0.01" value="0" class="mt-1 block w-full md:w-1/2 px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none"></div><div class="flex flex-col md:flex-row items-center justify-between bg-gray-50 p-4 rounded-lg"><label for="terraceColorSelection" class="text-sm font-medium text-gray-900 w-full md:w-1/2">Vyberte odstín terasy:</label><select id="terraceColorSelection" class="mt-1 block w-full md:w-1/2 px-3 py-2 border border-gray-300 rounded-md"><option value="original-wood">Original wood</option><option value="teak">Teak</option><option value="brownisch-red">Brownisch red</option><option value="chocolate">Chocolate</option><option value="stone-grey">Stone grey</option><option value="dark-grey">Dark grey</option></select></div><div class="flex items-center bg-gray-50 p-4 rounded-lg"><label for="montazCheckbox" class="text-sm font-medium text-gray-900 mr-2">Montáž na ideální podloží viz. montážní návod</label><input type="checkbox" id="montazCheckbox" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"></div><p class="text-red-600 text-sm mt-2"><strong>Celková částka se může lišit v závislosti na stavu podloží — pro přesnou kalkulaci je nutné objednat zaměření.</strong></p><div class="flex items-center bg-gray-50 p-4 rounded-lg"><label for="prepaymentDiscountCheckbox" class="text-sm font-medium text-gray-900 mr-2">Sleva 5 % při platbě předem</label><input type="checkbox" id="prepaymentDiscountCheckbox" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"></div></div><button type="submit" class="calculate-button w-full mt-8 flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium">Spočítat cenu</button></form><div id="terrace-results" class="mt-8 hidden"><h2 class="text-2xl font-bold text-gray-900 mb-4">Výsledná kalkulace</h2><div class="bg-amber-50 p-4 rounded-lg border-l-4 border-amber-500 mb-6"><p class="font-bold text-amber-800">Všechny uvedené ceny jsou pouze orientační.</p></div><div class="overflow-x-auto"><table class="min-w-full divide-y divide-gray-200"><thead class="bg-gray-50"><tr><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Položka</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Počet kusů</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cena bez DPH (Kč)</th></tr></thead><tbody class="bg-white divide-y divide-gray-200" id="terraceCalculationTableBody"></tbody><tfoot class="bg-gray-50"><tr><td colspan="2" class="px-6 py-3 text-left font-bold text-gray-900 uppercase">Celkem bez DPH</td><td id="terraceTotalPrice" class="px-6 py-3 text-right font-bold text-gray-900">0 Kč</td></tr><tr><td colspan="2" class="px-6 py-3 text-left font-bold text-gray-900 uppercase">Celkem s DPH</td><td id="terraceTotalPriceVAT" class="px-6 py-3 text-right font-bold text-gray-900">0 Kč</td></tr></tfoot></table></div><div class="flex flex-col md:flex-row justify-center space-y-4 md:space-y-0 md:space-x-4 mt-6"><button id="terraceNewButton1" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium highlighted-button">Objednat materiál</button><button id="terraceSaveToPdfButton" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white">Uložit jako PDF</button><button id="terraceNewButton2" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium highlighted-button">Objednat zaměření</button></div></div></div><!-- PLOT 90x13 --><div id="fence-90x13-calculator" class="hidden"><h1 class="text-3xl font-bold text-center text-gray-900 mb-6">Orientační cenová kalkulace plotových profilů 90x13 mm (svislé použití)</h1><div class="bg-red-50 p-4 rounded-lg border-l-4 border-red-600 mb-6"><p class="text-red-800 font-extrabold uppercase tracking-wide">UPOZORNĚNÍ: Jedná se POUZE o cenovou kalkulaci plotové výplně a montáže WPC</p></div><div class="bg-blue-50 p-4 rounded-lg border-l-4 border-blue-600 mb-6"><p class="text-blue-800 font-semibold">Před objednáním si zkontrolujte dostupnost materiálu <a href="https://drive.google.com/file/d/14ysyAVzcd852sDX1GcnUqTGFJEvCUPOm/view" target="_blank" rel="noopener" class="underline text-blue-800">zde</a>.</p></div><!-- E‑MAIL (povinné)–plot 90x13 --><!-- E‑MAIL (povinné)–styl sjednocenýs ostatnímiřádky --><div class="flex flex-col md:flex-row items-center justify-between bg-gray-50 p-4 rounded-lg mb-2"><label for="userEmail90x13" class="text-sm font-medium text-gray-900 w-full md:w-1/2">E‑mail (povinné)</label><input type="email" id="userEmail90x13" data-email-required="" class="mt-1 block w-full md:w-1/2 px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none" placeholder="např. jan.novak@email.cz"></div><p class="text-xs text-gray-500 mb-6">Bez vyplněného e‑mailu nenímožnéspočítat kalkulaci.</p><p class="text-center text-gray-600 mb-8">Zadejte prosím parametry plotu pro výpočet orientační ceny.</p><form id="fence90x13Form"><div id="fencePanelsContainer-90x13" class="space-y-8"></div><div class="flex items-center mt-4"><button type="button" id="addFencePanelBtn-90x13" class="highlighted-button w-full md:w-auto flex-1 py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium">+ Přidat další pole</button></div><div class="space-y-6 mt-8"><div class="bg-gray-50 p-4 rounded-lg flex items-center"><label for="triangularHeadCheckbox-90x13" class="text-sm font-medium text-gray-900 mr-2">Příplatek za tříhrannou hlavu (pro všechna pole)</label><input type="checkbox" id="triangularHeadCheckbox-90x13" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"></div><div class="bg-gray-50 p-4 rounded-lg flex items-center"><label for="montazFenceCheckbox-90x13" class="text-sm font-medium text-gray-900 mr-2">Montáž (pro všechna pole)</label><input type="checkbox" id="montazFenceCheckbox-90x13" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"></div><div class="flex items-center bg-gray-50 p-4 rounded-lg"><label for="prepaymentDiscountCheckbox-90x13" class="text-sm font-medium text-gray-900 mr-2">Sleva 5 % při platbě předem</label><input type="checkbox" id="prepaymentDiscountCheckbox-90x13" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"></div></div><button type="submit" class="calculate-button w-full mt-8 flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium">Spočítat celkovou cenu</button></form><div id="fence-90x13-results" class="mt-8 hidden"><h2 class="text-2xl font-bold text-gray-900 mb-4">Výsledná kalkulace</h2><div class="bg-amber-50 p-4 rounded-lg border-l-4 border-amber-500 mb-6"><p class="font-bold text-amber-800">Všechny uvedené ceny jsou pouze orientační.</p></div><div class="overflow-x-auto"><table class="min-w-full divide-y divide-gray-200"><thead class="bg-gray-50"><tr><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Položka</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Počet kusů</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Běžných metrů</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cena bez DPH (Kč)</th></tr></thead><tbody class="bg-white divide-y divide-gray-200" id="fence90x13CalculationTableBody"></tbody><tfoot class="bg-gray-50"><tr><td colspan="3" class="px-6 py-3 text-left font-bold text-gray-900 uppercase">Celkem bez DPH</td><td id="fence90x13TotalPrice" class="px-6 py-3 text-right font-bold text-gray-900">0 Kč</td></tr><tr><td colspan="3" class="px-6 py-3 text-left font-bold text-gray-900 uppercase">Celkem s DPH (12%)</td><td id="fence90x13TotalPriceVAT" class="px-6 py-3 text-right font-bold text-gray-900">0 Kč</td></tr></tfoot></table></div><div class="flex flex-col md:flex-row justify-center space-y-4 md:space-y-0 md:space-x-4 mt-6"><button id="fence90x13NewButton1" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium highlighted-button">Objednat materiál</button><button id="fence90x13SaveToPdfButton" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white">Uložit jako PDF</button><button id="fence90x13NewButton2" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium highlighted-button">Objednat zaměření</button></div></div></div><!-- PLOT 150x12 --><div id="fence-150x12-calculator" class="hidden"><h1 class="text-3xl font-bold text-center text-gray-900 mb-6">Orientační cenová kalkulace plotových profilů 150x12 mm (svislé použití)</h1><div class="bg-red-50 p-4 rounded-lg border-l-4 border-red-600 mb-6"><p class="text-red-800 font-extrabold uppercase tracking-wide">UPOZORNĚNÍ: Jedná se POUZE o cenovou kalkulaci plotové výplně a montáže WPC</p></div><div class="bg-blue-50 p-4 rounded-lg border-l-4 border-blue-600 mb-6"><p class="text-blue-800 font-semibold">Před objednáním si zkontrolujte dostupnost materiálu <a href="https://drive.google.com/file/d/14ysyAVzcd852sDX1GcnUqTGFJEvCUPOm/view" target="_blank" rel="noopener" class="underline text-blue-800">zde</a>.</p></div><!-- E‑MAIL (povinné)–plot 150x12 --><!-- E‑MAIL (povinné)–styl sjednocenýs ostatnímiřádky --><div class="flex flex-col md:flex-row items-center justify-between bg-gray-50 p-4 rounded-lg mb-2"><label for="userEmail150x12" class="text-sm font-medium text-gray-900 w-full md:w-1/2">E‑mail (povinné)</label><input type="email" id="userEmail150x12" data-email-required="" class="mt-1 block w-full md:w-1/2 px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none" placeholder="např. jan.novak@email.cz"></div><p class="text-xs text-gray-500 mb-6">Bez vyplněného e‑mailu nenímožnéspočítat kalkulaci.</p><p class="text-center text-gray-600 mb-8">Zadejte prosím parametry plotu pro výpočet orientační ceny.</p><form id="fence150x12Form"><div id="fencePanelsContainer-150x12" class="space-y-8"></div><div class="flex items-center mt-4"><button type="button" id="addFencePanelBtn-150x12" class="highlighted-button w-full md:w-auto flex-1 py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium">+ Přidat další pole</button></div><div class="space-y-6 mt-8"><div class="bg-gray-50 p-4 rounded-lg flex items-center"><label for="triangularHeadCheckbox-150x12" class="text-sm font-medium text-gray-900 mr-2">Příplatek za tříhrannou hlavu (pro všechna pole)</label><input type="checkbox" id="triangularHeadCheckbox-150x12" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"></div><div class="bg-gray-50 p-4 rounded-lg flex items-center"><label for="montazFenceCheckbox-150x12" class="text-sm font-medium text-gray-900 mr-2">Montáž (pro všechna pole)</label><input type="checkbox" id="montazFenceCheckbox-150x12" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"></div><div class="flex items-center bg-gray-50 p-4 rounded-lg"><label for="prepaymentDiscountCheckbox-150x12" class="text-sm font-medium text-gray-900 mr-2">Sleva 5 % při platbě předem</label><input type="checkbox" id="prepaymentDiscountCheckbox-150x12" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"></div></div><button type="submit" class="calculate-button w-full mt-8 flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium">Spočítat celkovou cenu</button></form><div id="fence-150x12-results" class="mt-8 hidden"><h2 class="text-2xl font-bold text-gray-900 mb-4">Výsledná kalkulace</h2><div class="bg-amber-50 p-4 rounded-lg border-l-4 border-amber-500 mb-6"><p class="font-bold text-amber-800">Všechny uvedené ceny jsou pouze orientační.</p></div><div class="overflow-x-auto"><table class="min-w-full divide-y divide-gray-200"><thead class="bg-gray-50"><tr><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Položka</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Počet kusů</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Běžných metrů</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cena bez DPH (Kč)</th></tr></thead><tbody class="bg-white divide-y divide-gray-200" id="fence150x12CalculationTableBody"></tbody><tfoot class="bg-gray-50"><tr><td colspan="3" class="px-6 py-3 text-left font-bold text-gray-900 uppercase">Celkem bez DPH</td><td id="fence150x12TotalPrice" class="px-6 py-3 text-right font-bold text-gray-900">0 Kč</td></tr><tr><td colspan="3" class="px-6 py-3 text-left font-bold text-gray-900 uppercase">Celkem s DPH (12%)</td><td id="fence150x12TotalPriceVAT" class="px-6 py-3 text-right font-bold text-gray-900">0 Kč</td></tr></tfoot></table></div><div class="flex flex-col md:flex-row justify-center space-y-4 md:space-y-0 md:space-x-4 mt-6"><button id="fence150x12NewButton1" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium highlighted-button">Objednat materiál</button><button id="fence150x12SaveToPdfButton" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white">Uložit jako PDF</button><button id="fence150x12NewButton2" class="w-full md:w-auto py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium highlighted-button">Objednat zaměření</button></div></div></div></div></div><script>let selectedPickupPoint = null;function formatPrice(price) {return new Intl.NumberFormat('cs-CZ', { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(price);}document.addEventListener('DOMContentLoaded', () => {const activeLink = document.querySelector('a[data-target="terrace-calculator"]');if (activeLink) activeLink.classList.add('active-link');// Default 1 panel v každém plotovém kalkulátoruaddFencePanel90x13();addFencePanel150x12();});let panelCounter90x13 = 0;let panelCounter150x12 = 0;// Panel s křížkem + max výška 4 m + editovatelný "Počet stejných polí"function createFencePanelHTML(panelIndex, prefix, initialValues = {}) {const { length = '0', height = '0', plankGap = '0', color = 'original-wood' } = initialValues;return `<div id="${prefix}Panel-${panelIndex}" class="bg-gray-100 p-6 rounded-lg shadow-inner"><div class="flex items-center justify-between mb-4"><h3 class="text-xl font-semibold text-gray-800">Plotové pole ${panelIndex + 1}</h3><button type="button" aria-label="Zavřít pole" title="Zavřít pole"class="w-8 h-8 inline-flex items-center justify-center rounded-full text-gray-500 hover:text-red-600 hover:bg-red-50 border border-transparent hover:border-red-200"onclick="removeFencePanel('${prefix}', ${panelIndex})">×</button></div><div class="space-y-4"><div class="flex flex-col md:flex-row items-center justify-between bg-white p-4 rounded-lg"><label for="${prefix}Length-${panelIndex}" class="text-sm font-medium text-gray-900 w-full md:w-1/2">Požadovaná délka pole v metrech:</label><input type="number" id="${prefix}Length-${panelIndex}" min="0" step="0.01" value="${length}" class="mt-1 block w-full md:w-1/2 px-3 py-2 border border-gray-300 rounded-md"></div><div class="flex flex-col md:flex-row items-center justify-between bg-white p-4 rounded-lg"><label for="${prefix}Height-${panelIndex}" class="text-sm font-medium text-gray-900 w-full md:w-1/2">Výška plotu v metrech <span class="hint">(max. 4,0 m)</span>:</label><input type="number" id="${prefix}Height-${panelIndex}" min="0" max="4" step="0.01" value="${height}" class="mt-1 block w-full md:w-1/2 px-3 py-2 border border-gray-300 rounded-md" inputmode="decimal"></div><div class="flex flex-col md:flex-row items-center justify-between bg-white p-4 rounded-lg"><label class="text-sm font-medium text-gray-900 w-full md:w-1/2">Doporučený počet vodorovných nosných profilů (ryglů):</label><span id="${prefix}NosneProfilyDisplay-${panelIndex}" class="mt-1 block w-full md:w-1/2 px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm sm:text-sm font-bold text-gray-900">0 ks</span><input type="hidden" id="${prefix}NosneProfily-${panelIndex}" value="0"></div><div class="flex flex-col md:flex-row items-center justify-between bg-white p-4 rounded-lg"><label for="${prefix}PlankGap-${panelIndex}" class="text-sm font-medium text-gray-900 w-full md:w-1/2">Mezera mezi plaňkami (mm):</label><input type="number" id="${prefix}PlankGap-${panelIndex}" min="0" step="1" value="${plankGap}" class="mt-1 block w-full md:w-1/2 px-3 py-2 border border-gray-300 rounded-md"></div><div class="flex flex-col md:flex-row items-center justify-between bg-white p-4 rounded-lg"><label for="${prefix}ColorSelection-${panelIndex}" class="text-sm font-medium text-gray-900 w-full md:w-1/2">Vyberte odstín plotu:</label><select id="${prefix}ColorSelection-${panelIndex}" class="mt-1 block w-full md:w-1/2 px-3 py-2 border border-gray-300 rounded-md"><option value="original-wood" ${color === 'original-wood' ? 'selected' : ''}>Original wood</option><option value="teak" ${color === 'teak' ? 'selected' : ''}>Teak</option><option value="brownisch-red" ${color === 'brownisch-red' ? 'selected' : ''}>Brownisch red</option><option value="chocolate" ${color === 'chocolate' ? 'selected' : ''}>Chocolate</option><option value="stone-grey" ${color === 'stone-grey' ? 'selected' : ''}>Stone grey</option><option value="dark-grey" ${color === 'dark-grey' ? 'selected' : ''}>Dark grey</option></select></div><!-- Editovatelný počet stejných polí + tučný label --><div class="flex flex-col md:flex-row items-center justify-between bg-white p-4 rounded-lg"><label for="${prefix}DuplicateCount-${panelIndex}" class="text-sm font-bold text-gray-900 w-full md:w-1/2">Počet stejných polí:</label><input type="number" id="${prefix}DuplicateCount-${panelIndex}" min="1" value="1" class="mt-1 block w-full md:w-1/2 px-3 py-2 bg-white border border-gray-300 rounded-md text-gray-900"></div></div></div>`;}// Ořez výšky + přepočet nosných profilůfunction clampHeightInput(prefix, panelIndex) {const el = document.getElementById(`${prefix}Height-${panelIndex}`);if (!el) return;let v = parseFloat(el.value);if (isNaN(v)) return;if (v > 4) { v = 4; el.value = '4.00'; }if (v < 0) { v = 0; el.value = '0'; }updateNosneProfily(prefix, panelIndex);}// Odebrání pole (přes křížek)function removeFencePanel(prefix, index) {const el = document.getElementById(`${prefix}Panel-${index}`);if (el) el.remove();}window.removeFencePanel = removeFencePanel;// Přidání panelůfunction addFencePanel90x13() {const panelIndex = panelCounter90x13;const container = document.getElementById('fencePanelsContainer-90x13');container.insertAdjacentHTML('beforeend', createFencePanelHTML(panelIndex, 'fence90x13'));const heightInput = document.getElementById(`fence90x13Height-${panelIndex}`);if (heightInput) {heightInput.addEventListener('input', () => clampHeightInput('fence90x13', panelIndex));clampHeightInput('fence90x13', panelIndex);}panelCounter90x13++;}function addFencePanel150x12() {const panelIndex = panelCounter150x12;const container = document.getElementById('fencePanelsContainer-150x12');container.insertAdjacentHTML('beforeend', createFencePanelHTML(panelIndex, 'fence150x12'));const heightInput = document.getElementById(`fence150x12Height-${panelIndex}`);if (heightInput) {heightInput.addEventListener('input', () => clampHeightInput('fence150x12', panelIndex));clampHeightInput('fence150x12', panelIndex);}panelCounter150x12++;}function updateNosneProfily(prefix, panelIndex) {const valEl = document.getElementById(`${prefix}Height-${panelIndex}`);let fenceHeight = valEl ? parseFloat(valEl.value) : 0;if (isNaN(fenceHeight)) fenceHeight = 0;fenceHeight = Math.min(Math.max(fenceHeight, 0), 4);let nosneProfilyCount = Math.ceil(fenceHeight / 0.64);if (nosneProfilyCount < 2) nosneProfilyCount = 2;const displayEl = document.getElementById(`${prefix}NosneProfilyDisplay-${panelIndex}`);const hiddenEl = document.getElementById(`${prefix}NosneProfily-${panelIndex}`);if (displayEl) displayEl.textContent = `${nosneProfilyCount} ks`;if (hiddenEl) hiddenEl.value = nosneProfilyCount;}/* ===== TERASA (výpočet) ===== */document.getElementById('calculatorForm').addEventListener('submit', function(event) {event.preventDefault();if(!_ensureEmailOrWarn()) { return; }const vymera = parseFloat(document.getElementById('vymera').value) || 0;const obvod = parseFloat(document.getElementById('obvod').value) || 0;const montazSelected = document.getElementById('montazCheckbox').checked;const prepaymentDiscountSelected = document.getElementById('prepaymentDiscountCheckbox').checked;const terraceColor = document.getElementById('terraceColorSelection')?.value || 'original-wood';const prices = {podlahovyProfil: { countPerM2: 2.5, pricePerPiece: 669.00 },klipSpojovaci: { countPerM2: 29, price: 8.30 },nosnyProfil: { countPerM2: 1.8, pricePerPiece: 297.00 },zakoncovaciLista: { price: 239.00 },podlozkaGumova3mm: { price: 1059.00 },podlozkaGumova6mm: { price: 1035.00 },podlozkaGumova8mm: { price: 1029.00 },vrutStartovaci: { countPerM2: 1.5, price: 5.45 },vrutDoList: { price: 3.49 },doprava: { count: 1, price: 991.74 },montazWPC: { price: 745 },montazList: { price: 155 }};const taxRate = montazSelected ? 0.12 : 0.21; // upraveno: při montáži 12 %, jinak 21 %const listaCount = Math.ceil((obvod / 2.9) + 1);const nosnyProfilCount = Math.ceil(vymera * prices.nosnyProfil.countPerM2);const materialCalculations = [{ name: 'Podlahový profil – ' + terraceColor, count: Math.ceil(vymera * prices.podlahovyProfil.countPerM2), price: Math.ceil(vymera * prices.podlahovyProfil.countPerM2) * prices.podlahovyProfil.pricePerPiece },{ name: 'Nosný profil', count: nosnyProfilCount, price: nosnyProfilCount * prices.nosnyProfil.pricePerPiece },{ name: 'Klip spojovací nerez včetně vrutu', count: vymera * prices.klipSpojovaci.countPerM2, price: vymera * prices.klipSpojovaci.countPerM2 * prices.klipSpojovaci.price },{ name: 'Zakončovací lišta – ' + terraceColor, count: listaCount, price: listaCount * prices.zakoncovaciLista.price },{ name: 'Podložka gumová 3mm (10m)', count: 1, price: prices.podlozkaGumova3mm.price },{ name: 'Podložka gumová 6mm (5m)', count: 1, price: prices.podlozkaGumova6mm.price },{ name: 'Podložka gumová 8mm (5m)', count: 1, price: prices.podlozkaGumova8mm.price },{ name: 'Vrut 5x50 - startovací', count: Math.ceil(vymera * prices.vrutStartovaci.countPerM2), price: Math.ceil(vymera * prices.vrutStartovaci.countPerM2) * prices.vrutStartovaci.price },{ name: 'Vrut 3,5x35 - do lišt', count: Math.ceil(listaCount * 2.9 * 7), price: Math.ceil(listaCount * 2.9 * 7) * prices.vrutDoList.price },];let materialPrice = materialCalculations.reduce((s, i) => s + i.price, 0);let nonMaterialPrice = 0;const finalCalculations = [...materialCalculations];if (!montazSelected) {finalCalculations.push({ name: 'Doprava', count: prices.doprava.count, price: prices.doprava.price });nonMaterialPrice += prices.doprava.price;}if (montazSelected) {finalCalculations.push({ name: 'Montáž WPC profilů', count: vymera, price: vymera * prices.montazWPC.price });finalCalculations.push({ name: 'Montáž lišt', count: obvod, price: obvod * prices.montazList.price });const montazNaklady = materialPrice * 0.10;finalCalculations.push({ name: 'Ostatní montážní náklady', count: 1, price: montazNaklady });nonMaterialPrice += (vymera * prices.montazWPC.price) + (obvod * prices.montazList.price) + montazNaklady;}if (prepaymentDiscountSelected) {const discountAmount = materialPrice * 0.05;materialPrice -= discountAmount;finalCalculations.push({ name: 'Sleva za platbu předem (5%) - materiál', count: 1, price: -discountAmount });}const totalPrice = materialPrice + nonMaterialPrice;const totalPriceVAT = totalPrice * (1 + taxRate);const tableBody = document.getElementById('terraceCalculationTableBody');tableBody.innerHTML = '';finalCalculations.forEach(item => {const row = document.createElement('tr');const isPhysicalItem = !item.name.includes('Montáž') && !item.name.includes('Doprava') && !item.name.includes('Ostatní') && !item.name.includes('Sleva');const countDisplay = isPhysicalItem ? Math.ceil(item.count) : (item.count < 0 ? item.count : item.count.toFixed(2));const priceClass = item.price < 0 ? 'text-red-600' : 'text-gray-900';const countClass = item.count < 0 ? 'text-red-600' : 'text-gray-900';row.innerHTML = `<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${item.name}</td><td class="px-6 py-4 whitespace-nowrap text-sm ${countClass}">${countDisplay}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-right ${priceClass}">${formatPrice(item.price)} Kč</td>`;tableBody.appendChild(row);});document.getElementById('terraceTotalPrice').textContent = `${formatPrice(totalPrice)} Kč`;document.getElementById('terraceTotalPriceVAT').textContent = `${formatPrice(totalPriceVAT)} Kč`;const _terrRes = document.getElementById('terrace-results');_terrRes.classList.remove('hidden');_terrRes.scrollIntoView({ behavior: 'smooth', block: 'start' });});/* ===== FENCE 90x13 ===== */document.getElementById('fence90x13Form').addEventListener('submit', function(event) {event.preventDefault();if(!_ensureEmailOrWarn()) { return; }const fencePanels = document.querySelectorAll('#fence-90x13-calculator .bg-gray-100');const montazSelected = document.getElementById('montazFenceCheckbox-90x13')?.checked || false;const triangularHeadSelected = document.getElementById('triangularHeadCheckbox-90x13')?.checked || false;const prepaymentDiscountSelected = document.getElementById('prepaymentDiscountCheckbox-90x13')?.checked || false;const prices = {plotovyProfil: { pricePerPiece: 156.00, length: 1.5, width: 0.09 },texScrew: { price: 3.49 },doprava: { price: 991.74 },montaz: { pricePerPlank2Rails: 60.00, pricePerPlank3Rails: 90.00, pricePerPlank4Rails: 120.00 },ostatniNaklady: 0.10,};const rezaniNaMiruPricePerPiece = triangularHeadSelected ? 12.00 : 4.00;let totalMaterialPrice = 0;let totalMontazPrice = 0;const finalCalculations = [];let totalPlankCount = 0;let totalMeters = 0;let totalTexScrews = 0;fencePanels.forEach(panel => {const idParts = panel.id.split('-');const index = parseInt(idParts[idParts.length - 1], 10);const length = parseFloat(document.getElementById(`fence90x13Length-${index}`).value) || 0;let height = parseFloat(document.getElementById(`fence90x13Height-${index}`).value) || 0;height = Math.min(Math.max(height, 0), 4); // limit 0..4 mconst plankGap = (parseFloat(document.getElementById(`fence90x13PlankGap-${index}`).value) || 0) / 1000;const nosneProfilyCount = parseInt(document.getElementById(`fence90x13NosneProfily-${index}`).value, 10) || 2;const duplicateCount = Math.max(1, parseInt(document.getElementById(`fence90x13DuplicateCount-${index}`).value, 10) || 1);const roundedHeight = Math.ceil(height * 10) / 10;const plankCount = Math.ceil(length / (prices.plotovyProfil.width + plankGap));totalPlankCount += plankCount * duplicateCount;totalMeters += plankCount * roundedHeight * duplicateCount;const plotovyProfilPrice = (plankCount * roundedHeight * duplicateCount) * (prices.plotovyProfil.pricePerPiece / prices.plotovyProfil.length);totalMaterialPrice += plotovyProfilPrice;const colorSelect90 = document.getElementById(`fence90x13ColorSelection-${index}`);const colorText90 = colorSelect90 ? colorSelect90.options[colorSelect90.selectedIndex].text : '';finalCalculations.push({ name: `Plotový profil 90x13 mm – ${colorText90}, délka ${roundedHeight.toFixed(1)} m`, count: plankCount * duplicateCount, meters: plankCount * roundedHeight * duplicateCount, price: plotovyProfilPrice });const texScrewsCountForPanel = plankCount * nosneProfilyCount * duplicateCount;totalTexScrews += texScrewsCountForPanel;if (montazSelected) {let montazPricePerPlank = 0;if (nosneProfilyCount === 2) montazPricePerPlank = prices.montaz.pricePerPlank2Rails;else if (nosneProfilyCount === 3) montazPricePerPlank = prices.montaz.pricePerPlank3Rails;else if (nosneProfilyCount === 4) montazPricePerPlank = prices.montaz.pricePerPlank4Rails;totalMontazPrice += plankCount * montazPricePerPlank * duplicateCount; // opraveno: výška se už nezapočítává}});const rezaniNaMiruPrice = totalPlankCount * rezaniNaMiruPricePerPiece;const rezaniName = triangularHeadSelected ? 'Řezání na míru (tříhranná hlava)' : 'Řezání na míru';finalCalculations.push({ name: rezaniName, count: totalPlankCount, meters: 0, price: rezaniNaMiruPrice });totalMaterialPrice += rezaniNaMiruPrice;const texScrewsPrice = totalTexScrews * prices.texScrew.price;finalCalculations.push({ name: 'TEX 6,3x32 zápustná hlava', count: totalTexScrews, meters: 0, price: texScrewsPrice });totalMaterialPrice += texScrewsPrice;let totalNonMaterialPrice = 0;if (!montazSelected) {finalCalculations.push({ name: 'Doprava', count: 1, meters: 0, price: prices.doprava.price });totalNonMaterialPrice += prices.doprava.price;}if (montazSelected) {finalCalculations.push({ name: 'Montáž WPC plotových profilů', count: totalPlankCount, meters: totalMeters, price: totalMontazPrice });const ostatniNaklady = (totalMaterialPrice + totalMontazPrice) * prices.ostatniNaklady;finalCalculations.push({ name: 'Ostatní montážní náklady', count: 1, meters: 0, price: ostatniNaklady });totalNonMaterialPrice += ostatniNaklady;}if (prepaymentDiscountSelected) {const discountAmount = totalMaterialPrice * 0.05;finalCalculations.push({ name: 'Sleva za platbu předem (5%)', count: 1, meters: 0, price: -discountAmount });totalMaterialPrice -= discountAmount;}const totalPrice = totalMaterialPrice + totalMontazPrice + totalNonMaterialPrice;const taxRate = montazSelected ? 0.12 : 0.21; // upraveno: při montáži 12 %, jinak 21 %const totalPriceVAT = totalPrice * (1 + taxRate);const tableBody = document.getElementById('fence90x13CalculationTableBody');tableBody.innerHTML = '';finalCalculations.forEach(item => {const row = document.createElement('tr');let countDisplay = item.count;if (item.name.includes('Plotové profily')) countDisplay = `${Math.ceil(item.count)} ks`;const priceClass = item.price < 0 ? 'text-red-600' : 'text-gray-900';const countClass = item.count < 0 ? 'text-red-600' : 'text-gray-900';const metersDisplay = item.meters > 0 ? formatPrice(item.meters) + ' bm' : '-';row.innerHTML = `<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${item.name}</td><td class="px-6 py-4 whitespace-nowrap text-sm ${countClass}">${countDisplay}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-left text-gray-900">${metersDisplay}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-right ${priceClass}">${formatPrice(item.price)} Kč</td>`;tableBody.appendChild(row);});document.getElementById('fence90x13TotalPrice').textContent = `${formatPrice(totalPrice)} Kč`;document.getElementById('fence90x13TotalPriceVAT').textContent = `${formatPrice(totalPriceVAT)} Kč`;const _f9013Res = document.getElementById('fence-90x13-results');_f9013Res.classList.remove('hidden');_f9013Res.scrollIntoView({ behavior: 'smooth', block: 'start' });});/* ===== FENCE 150x12 ===== */document.getElementById('fence150x12Form').addEventListener('submit', function(event) {event.preventDefault();if(!_ensureEmailOrWarn()) { return; }const fencePanels = document.querySelectorAll('#fence-150x12-calculator .bg-gray-100');const montazSelected = document.getElementById('montazFenceCheckbox-150x12')?.checked || false;const triangularHeadSelected = document.getElementById('triangularHeadCheckbox-150x12')?.checked || false;const prepaymentDiscountSelected = document.getElementById('prepaymentDiscountCheckbox-150x12')?.checked || false;const prices = {plotovyProfil: { pricePerPiece: 241.50, length: 1.5, width: 0.15 },texScrew: { price: 3.49 },doprava: { price: 991.74 },montaz: { pricePerPlank2Rails: 90.00, pricePerPlank3Rails: 135.00, pricePerPlank4Rails: 180.00 },ostatniNaklady: 0.10,};const rezaniNaMiruPricePerPiece = triangularHeadSelected ? 12.00 : 4.00;let totalMaterialPrice = 0;let totalMontazPrice = 0;const finalCalculations = [];let totalPlankCount = 0;let totalMeters = 0;let totalTexScrews = 0;fencePanels.forEach(panel => {const idParts = panel.id.split('-');const index = parseInt(idParts[idParts.length - 1], 10);const length = parseFloat(document.getElementById(`fence150x12Length-${index}`).value) || 0;let height = parseFloat(document.getElementById(`fence150x12Height-${index}`).value) || 0;height = Math.min(Math.max(height, 0), 4); // limit 0..4 mconst plankGap = (parseFloat(document.getElementById(`fence150x12PlankGap-${index}`).value) || 0) / 1000;const nosneProfilyCount = parseInt(document.getElementById(`fence150x12NosneProfily-${index}`).value, 10) || 2;const duplicateCount = Math.max(1, parseInt(document.getElementById(`fence150x12DuplicateCount-${index}`).value, 10) || 1);const roundedHeight = Math.ceil(height * 10) / 10;const plankCount = Math.ceil(length / (prices.plotovyProfil.width + plankGap));totalPlankCount += plankCount * duplicateCount;totalMeters += plankCount * roundedHeight * duplicateCount;const plotovyProfilPrice = (plankCount * roundedHeight * duplicateCount) * (prices.plotovyProfil.pricePerPiece / prices.plotovyProfil.length);totalMaterialPrice += plotovyProfilPrice;const colorSelect150 = document.getElementById(`fence150x12ColorSelection-${index}`);const colorText150 = colorSelect150 ? colorSelect150.options[colorSelect150.selectedIndex].text : '';finalCalculations.push({ name: `Plotový profil 150x12 mm – ${colorText150}, délka ${roundedHeight.toFixed(1)} m`, count: plankCount * duplicateCount, meters: plankCount * roundedHeight * duplicateCount, price: plotovyProfilPrice });// TEX: 2 šrouby na plotovku na každý ryglconst texScrewsCountForPanel = plankCount * (nosneProfilyCount * 2) * duplicateCount;totalTexScrews += texScrewsCountForPanel;if (montazSelected) {let montazPricePerPlank = 0;if (nosneProfilyCount === 2) montazPricePerPlank = prices.montaz.pricePerPlank2Rails;else if (nosneProfilyCount === 3) montazPricePerPlank = prices.montaz.pricePerPlank3Rails;else if (nosneProfilyCount === 4) montazPricePerPlank = prices.montaz.pricePerPlank4Rails;totalMontazPrice += plankCount * montazPricePerPlank * duplicateCount; // opraveno: výška se už nezapočítává}});const rezaniNaMiruPrice = totalPlankCount * rezaniNaMiruPricePerPiece;const rezaniName = triangularHeadSelected ? 'Řezání na míru (tříhranná hlava)' : 'Řezání na míru';finalCalculations.push({ name: rezaniName, count: totalPlankCount, meters: 0, price: rezaniNaMiruPrice });totalMaterialPrice += rezaniNaMiruPrice;const texScrewsPrice = totalTexScrews * prices.texScrew.price;finalCalculations.push({ name: 'TEX 6,3x32 zápustná hlava', count: totalTexScrews, meters: 0, price: texScrewsPrice });totalMaterialPrice += texScrewsPrice;let totalNonMaterialPrice = 0;if (!montazSelected) {finalCalculations.push({ name: 'Doprava', count: 1, meters: 0, price: prices.doprava.price });totalNonMaterialPrice += prices.doprava.price;}if (montazSelected) {finalCalculations.push({ name: 'Montáž WPC plotových profilů', count: totalPlankCount, meters: totalMeters, price: totalMontazPrice });const ostatniNaklady = (totalMaterialPrice + totalMontazPrice) * prices.ostatniNaklady;finalCalculations.push({ name: 'Ostatní montážní náklady', count: 1, meters: 0, price: ostatniNaklady });totalNonMaterialPrice += ostatniNaklady;}if (prepaymentDiscountSelected) {const discountAmount = totalMaterialPrice * 0.05;finalCalculations.push({ name: 'Sleva za platbu předem (5%)', count: 1, meters: 0, price: -discountAmount });totalMaterialPrice -= discountAmount;}const totalPrice = totalMaterialPrice + totalMontazPrice + totalNonMaterialPrice;const taxRate = montazSelected ? 0.12 : 0.21; // upraveno: při montáži 12 %, jinak 21 %const totalPriceVAT = totalPrice * (1 + taxRate);const tableBody = document.getElementById('fence150x12CalculationTableBody');tableBody.innerHTML = '';finalCalculations.forEach(item => {const row = document.createElement('tr');let countDisplay = item.count;if (item.name.includes('Plotové profily')) countDisplay = `${Math.ceil(item.count)} ks`;const priceClass = item.price < 0 ? 'text-red-600' : 'text-gray-900';const countClass = item.count < 0 ? 'text-red-600' : 'text-gray-900';const metersDisplay = item.meters > 0 ? formatPrice(item.meters) + ' bm' : '-';row.innerHTML = `<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${item.name}</td><td class="px-6 py-4 whitespace-nowrap text-sm ${countClass}">${countDisplay}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-left text-gray-900">${metersDisplay}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-right ${priceClass}">${formatPrice(item.price)} Kč</td>`;tableBody.appendChild(row);});document.getElementById('fence150x12TotalPrice').textContent = `${formatPrice(totalPrice)} Kč`;document.getElementById('fence150x12TotalPriceVAT').textContent = `${formatPrice(totalPriceVAT)} Kč`;const _f15012Res = document.getElementById('fence-150x12-results');_f15012Res.classList.remove('hidden');_f15012Res.scrollIntoView({ behavior: 'smooth', block: 'start' });});/* PDF export */document.getElementById('terraceSaveToPdfButton').addEventListener('click', () => exportDivToPdf('terrace-results','kalkulace_terasy.pdf'));document.getElementById('fence90x13SaveToPdfButton').addEventListener('click', () => exportDivToPdf('fence-90x13-results','kalkulace_plotu_90x13.pdf'));document.getElementById('fence150x12SaveToPdfButton').addEventListener('click', () => exportDivToPdf('fence-150x12-results','kalkulace_plotu_150x12.pdf'));function exportDivToPdf(divId, filename) {const resultsDiv = document.getElementById(divId);const originalWidth = resultsDiv.style.width;// Zmenšíme šířku pro menší canvas (nižší rozlišení => menší PDF)resultsDiv.style.width = '900px';const MAX_BYTES = 4 * 1024 * 1024; // 4 MBconst qualities = [0.85, 0.75, 0.65, 0.55, 0.45, 0.35]; // postupné snižování kvality, když je soubor moc velkýhtml2canvas(resultsDiv, { scale: 1 }).then(canvas => {const { jsPDF } = window.jspdf;const pdfWidthMm = 200; // šířka obrázku v PDF (mm)const pdfPageHeightMm = 295; // výška stránky A4 (mm)const leftMarginMm = 5;// Výška jedné PDF stránky přepočtená do pixelů dle poměru šířkyconst pageHeightPx = Math.floor(canvas.width * (pdfPageHeightMm / pdfWidthMm));function buildPdf(quality) {const doc = new jsPDF('p', 'mm', 'a4');for (let y = 0, page = 0; y < canvas.height; y += pageHeightPx, page++) {const sliceHeightPx = Math.min(pageHeightPx, canvas.height - y);// připravit dočasný canvas s výškou jen pro danou stránkuconst pageCanvas = document.createElement('canvas');pageCanvas.width = canvas.width;pageCanvas.height = sliceHeightPx;const ctx = pageCanvas.getContext('2d');ctx.drawImage(canvas, 0, y, canvas.width, sliceHeightPx, 0, 0, canvas.width, sliceHeightPx);// JPEG s danou kvalitou (mnohem menší než PNG)const imgData = pageCanvas.toDataURL('image/jpeg', quality);// přepočet výšky slice do mm při zachování poměru stranconst sliceHeightMm = (sliceHeightPx / canvas.width) * pdfWidthMm;if (page > 0) doc.addPage();doc.addImage(imgData, 'JPEG', leftMarginMm, 0, pdfWidthMm, sliceHeightMm);}return doc;}let pdf, blob;for (const q of qualities) {pdf = buildPdf(q);blob = pdf.output('blob');if (blob.size <= MAX_BYTES) break;}pdf.save(filename);resultsDiv.style.width = originalWidth;});}/* Přepínání kalkulátorů */document.querySelectorAll('nav a').forEach(link => {link.addEventListener('click', function() {const targetId = this.getAttribute('data-target');const allCalculators = document.querySelectorAll('#terrace-calculator, #fence-90x13-calculator, #fence-150x12-calculator');allCalculators.forEach(calc => calc.classList.add('hidden'));document.getElementById(targetId).classList.remove('hidden');document.querySelectorAll('nav a').forEach(navLink => navLink.classList.remove('active-link'));this.classList.add('active-link');});});/* Připojení tlačítek pro přidání panelů */document.getElementById('addFencePanelBtn-90x13').addEventListener('click', addFencePanel90x13);document.getElementById('addFencePanelBtn-150x12').addEventListener('click', addFencePanel150x12);</script><!-- VLOŽTE NA ÚPLNÝ KONEC HTML BLOKU NA WEBNODE (nahradí předchozí patch) --><!-- EmailJS SDK --><!-- VLOŽTE NA ÚPLNÝ KONEC HTML BLOKU NA WEBNODE (nahradí předchozí patch) --><!-- EmailJS SDK --><!-- VLOŽTE NA ÚPLNÝ KONEC HTML BLOKU NA WEBNODE (nahraďte tím úplně všechny staré skripty) --><!-- EmailJS SDK --><!-- POZNÁMKY k EmailJS:- TEMPLATE_ADMIN (template_3dooxrd): To = info@..., Subject = {{subject}}, Reply-To = {{reply_to}}, tělo {{{html_message}}}. Bez Bcc/Cc.- TEMPLATE_CUSTOMER (template_zgj478t): To = {{to_email}}, Subject = {{subject}}, Reply-To = info@..., tělo {{{html_message}}}. Bez Bcc/Cc na admin.- V HTML musí zůstat JEN tento skript (hledejte "EmailJS SDK"). Staré bloky odstraňte.--><!-- EmailJS SDK — ponechat jen JEDNOU --><div id="messageBox" class="message-box"></div><div id="orderModal" class="modal-overlay" onclick="if(event.target.id === 'orderModal') closeOrderModal();"><div class="modal-content-slide"><div class="flex justify-between items-start mb-6"><h2 class="text-2xl font-bold text-gray-900">Kontaktní údaje pro závaznou objednávku</h2><button onclick="closeOrderModal()" class="text-gray-400 hover:text-gray-600 text-4xl font-light leading-none transition-colors">×</button></div><form id="orderForm"><input type="hidden" id="modalEmailSource" value=""><div class="space-y-6"><div class="flex items-center pb-4"><input id="isCompany" type="checkbox" onchange="handleCompanyToggle()" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"><label for="isCompany" class="ml-2 block text-base font-medium text-gray-900">Nakupuji na firmu</label></div><br><div id="companyFields" class="space-y-4 bg-gray-50 p-4 rounded-lg border border-gray-200 company-fields-animated"><h3 class="text-xl font-semibold text-gray-900">Fakturační údaje (Firma)</h3><div><label for="orderCompanyName" class="block text-sm font-medium text-gray-700">Název společnosti *</label><input type="text" id="orderCompanyName" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div><div><label for="orderICO" class="block text-sm font-medium text-gray-700">IČO *</label><input type="text" id="orderICO" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div><hr class="border-t border-gray-300 mt-4 pt-4"><h3 class="text-lg font-semibold text-gray-800">Kontaktní osoba (pro komunikaci ohledně objednávky) *</h3><div class="grid grid-cols-1 md:grid-cols-2 gap-6"><div><label for="orderContactName" class="block text-sm font-medium text-gray-700">Jméno *</label><input type="text" id="orderContactName" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div><div><label for="orderContactSurname" class="block text-sm font-medium text-gray-700">Příjmení *</label><input type="text" id="orderContactSurname" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div></div><div><label for="orderContactPhone" class="block text-sm font-medium text-gray-700">Telefonní číslo *</label><input type="tel" id="orderContactPhone" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"><div><label for="orderContactEmail" class="block text-sm font-medium text-gray-700">E-mail *</label><input type="email" id="orderContactEmail" required="" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md"></div></div></div><div id="deliverySection" class="company-fields-animated"><div class="flex items-center pt-2 pb-4"><input id="isSameAddress" type="checkbox" checked="" onchange="handleSameAddressToggle()" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"><label for="isSameAddress" class="ml-2 block text-base font-medium text-gray-900">Dodat na fakturační adresu</label></div><br><div id="deliveryFields" class="space-y-4 bg-yellow-50 p-4 rounded-lg border border-gray-200 delivery-fields-inner-animated"><h3 class="text-lg font-semibold text-gray-800">Dodací adresa *</h3><div class="grid grid-cols-1 md:grid-cols-3 gap-6"><div class="md:col-span-2"><label for="deliveryAddressStreet" class="block text-sm font-medium text-gray-700">Ulice a číslo popisné *</label><input type="text" id="deliveryAddressStreet" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div><div><label for="deliveryAddressZip" class="block text-sm font-medium text-gray-700">PSČ *</label><input type="text" id="deliveryAddressZip" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div></div><div><label for="deliveryAddressCity" class="block text-sm font-medium text-gray-700">Město *</label><input type="text" id="deliveryAddressCity" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div></div></div><div id="privateCustomerGroup" class="space-y-4"><h3 class="text-xl font-semibold text-gray-900 pt-6">Kontaktní a fakturační údaje (Soukromá osoba)</h3><div class="grid grid-cols-1 md:grid-cols-2 gap-6"><div><label for="orderName" class="block text-sm font-medium text-gray-700">Jméno *</label><input type="text" id="orderName" required="" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div><div><label for="orderSurname" class="block text-sm font-medium text-gray-700">Příjmení *</label><input type="text" id="orderSurname" required="" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div></div><div><label for="orderPhone" class="block text-sm font-medium text-gray-700">Telefonní číslo *</label><input type="tel" id="orderPhone" required="" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div><div class="grid grid-cols-1 md:grid-cols-3 gap-6"><div class="md:col-span-2"><label for="orderAddressStreet" class="block text-sm font-medium text-gray-700">Ulice a číslo popisné *</label><input type="text" id="orderAddressStreet" required="" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div><div><label for="orderAddressZip" class="block text-sm font-medium text-gray-700">PSČ *</label><input type="text" id="orderAddressZip" required="" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div></div><div><label for="orderAddressCity" class="block text-sm font-medium text-gray-700">Město *</label><input type="text" id="orderAddressCity" required="" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500"></div></div><div id="shippingOptions" class="space-y-6 mt-8"><h3 class="text-xl font-semibold text-gray-900">Způsob dopravy *</h3><div class="space-y-4 bg-gray-50 p-4 rounded-lg border border-gray-200"><div id="pickupPointOption" class="flex items-center"><input id="shipping_pickup_point" name="shippingMethod" type="radio" value="Výdejní místo" required="" onchange="handleShippingChange()" class="h-4 w-4 text-stone-800 border-gray-300 focus:ring-stone-800"><label for="shipping_pickup_point" class="ml-3 block text-base font-medium text-gray-700">Výdejní místo <span id="selectedPickupPointName" class="ml-2 font-bold text-green-700 cursor-pointer underline underline-offset-2"></span></label></div><br><!-- MAPA VÝDEJNÍCH MÍST (LAMBOPONT) --><div id="pickupPointMapContainer" class="mt-6 hidden"><h4 class="text-lg font-semibold text-gray-900 mb-3">Vyberte prosím výdejní místo na mapě:</h4><div class="mb-4"><input type="text" id="pickupPointInput" placeholder="Např. Liberec" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500" readonly=""></div><div class="bg-white rounded-lg shadow-xl p-3"><div id="leafletMap" class="w-full" style="height:560px;"></div><div id="changePickupWrapper" class="mt-3" style="display:none;"><button id="changePickupBtn" type="button" class="calculate-button py-2 px-4 rounded-md" onclick="editPickupPoint()">Změnit výdejní místo</button></div><div id="pickupPointSummary" class="mt-3 hidden items-center justify-between bg-green-50 border border-green-200 rounded-md p-3"><div class="text-sm md:text-base"><strong>Vybrané výdejní místo:</strong><span id="pickupPointSummaryName" class="font-semibold"></span></div><div><button type="button" class="calculate-button py-2 px-4 rounded-md" onclick="editPickupPoint()">Změnit</button></div></div><div id="selectedPickupPointDisplay" class="mt-3 text-center text-lg font-bold" style="color:#15803d; display:none;">Vybrané výdejní místo: </div><input type="hidden" id="orderPickupPointId" name="orderPickupPointId" value=""><input type="hidden" id="orderPickupPointName" name="orderPickupPointName" value=""><div class="mt-4 flex justify-center"><button id="confirmPickupBtnModal" type="button" class="px-4 py-2 rounded-md highlighted-button" onclick="confirmPickupPoint()">Vybrat</button></div></div></div><!-- /MAPA VÝDEJNÍCH MÍST --><div class="flex items-center"><input id="shipping_personal_pickup" name="shippingMethod" type="radio" value="Osobní odběr" required="" onchange="handleShippingChange()" class="h-4 w-4 text-stone-800 border-gray-300 focus:ring-stone-800"><label for="shipping_personal_pickup" class="ml-3 block text-base font-medium text-gray-700">Osobní odběr</label></div><br><div class="flex items-center"><input id="shipping_delivery" name="shippingMethod" type="radio" value="Doprava na adresu" required="" onchange="handleShippingChange()" class="h-4 w-4 text-stone-800 border-gray-300 focus:ring-stone-800"><label for="shipping_delivery" class="ml-3 block text-base font-medium text-gray-700">Doprava na adresu</label></div><br></div></div><div id="pickupPointMapContainer" class="mt-6 hidden"><h4 class="text-lg font-semibold text-gray-900 mb-3">Vyberte prosím výdejní místo na mapě:</h4><div class="mb-4"><input type="text" id="pickupPointInput" placeholder="Např. Liberec" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-amber-500 focus:border-amber-500" readonly=""></div><div id="leafletMap" class="w-full" style="height: 560px;"></div><div id="selectedPickupPointDisplay" class="mt-2 text-center text-lg font-bold" style="color:#15803d; display:none;">Vybrané výdejní místo: </div><input type="hidden" id="orderPickupPointId" name="orderPickupPointId" value=""><input type="hidden" id="orderPickupPointName" name="orderPickupPointName" value=""><div id="pickupSummary" style="margin:12px 0; padding:10px 12px; border:1px solid #e2e8f0; border-radius:10px; display:none;"><span id="pickupSummaryText" style="color:#15803d; font-weight:700; display:block;">Vybrané výdejní místo: —</span><a id="changePickupPointLink" href="javascript:void(0)" style="display:inline-block;color:#dc2626;font-weight:700;text-decoration:none;margin-top:6px;">Změnit výdejní místo</a></div><div class="mt-3 flex justify-center"><button id="confirmPickupBtnModal" type="button" class="px-4 py-2 rounded-md highlighted-button" onclick="confirmPickupPoint()">Vybrat</button></div></div><!-- ZPŮSOB PLATBY --><div id="paymentOptions" class="space-y-6" style="margin-top: 1rem;"><h3 class="text-xl font-semibold text-gray-900">Způsob platby *</h3><div class="space-y-4 bg-gray-50 p-4 rounded-lg border border-gray-200"><label class="flex items-center"><input id="pay_qr" name="paymentMethod" type="radio" value="QR kódem" class="h-4 w-4 text-stone-800"><span class="ml-3">QR kódem</span></label><label class="flex items-center"><input id="pay_transfer" name="paymentMethod" type="radio" value="Převodním příkazem" class="h-4 w-4 text-stone-800"><span class="ml-3">Převodním příkazem</span></label><label class="flex items-center"><input id="pay_cash" name="paymentMethod" type="radio" value="Při předání v hotovosti" class="h-4 w-4 text-stone-800"><span class="ml-3">Při předání v hotovosti</span></label></div><br></div><!-- /ZPŮSOB PLATBY --><!-- POZNÁMKA PRO OBJEDNÁVKU --><div id="orderNoteBlock" class="space-y-2 bg-gray-50 p-4 rounded-lg border border-gray-200 mt-4"><label for="orderNote" class="text-sm font-medium text-gray-900">Poznámka k objednávce (nepovinné)</label><textarea id="orderNote" name="orderNote" rows="3" class="mt-1 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm" placeholder="Zde můžete uvést doplňující informace…"></textarea></div><button type="submit" class="calculate-button w-full mt-8 py-3 px-6 rounded-md shadow-lg text-lg font-bold transition-colors">Odeslat závaznou objednávku</button></div></form></div></div><script>document.getElementById('orderForm').addEventListener('submit', function(e){e.preventDefault();document.getElementById('orderModal').classList.remove('open');const thx = document.getElementById('thankYouMessage');thx.style.display = 'block';thx.scrollIntoView({ behavior: 'smooth' });submitOrderForm();location.reload();});</script><script>window.pickupPointsRaw = [{"id": "wpc-centrum-s-r-o-centralni-sklad", "name": "WPC centrum s.r.o. - centrální sklad", "address": "Heřmanice v Podještědí 135 Jablonné v Podještědí 47125"}, {"id": "evmat-stavby-s-r-o", "name": "EVMAT stavby s.r.o.", "address": "Budějovická 130 Jesenice u Prahy 252 42"}, {"id": "ploty-hradec-kralove-s-r-o", "name": "Ploty Hradec Králové s.r.o.", "address": "Cukrovarská 341 Hradec Králové-Smiřice 500 02"}, {"id": "ploty-pardubice-s-r-o", "name": "Ploty Pardubice s.r.o.", "address": "Průmyslová 344 Pardubice 530 01 AREÁL STERA 3000"}, {"id": "bc-jaroslav-nerusil", "name": "Bc. Jaroslav Nerušil", "address": "Rataje 89, Těšetice 783 46"}, {"id": "woodterrass", "name": "WoodTerrass", "address": "Kounice 5 Kounice 289 15"}, {"id": "gardina-cz-s-r-o", "name": "GARDINA.cz, s.r.o.", "address": "Poličany 54 Kutná Hora 284 01"}, {"id": "adh-ploty-s-r-o", "name": "ADH-PLOTY s.r.o.", "address": "Dolní Město 361 Dolní Město 282 33"}, {"id": "dluhos-s-r-o", "name": "DLUHOŠ s.r.o.", "address": "Hradecká 2714/68 Opava 746 01"}, {"id": "radim-jegla", "name": "Radim Jegla", "address": "Babice 38, Uherské Hradiště 687 03"}, {"id": "wpc-centrum-s-r-o-rozdrojovice", "name": "WPC centrum s.r.o. - Rozdrojovice", "address": "Žleby 194 Rozdrojovice 664 34"}, {"id": "stabo-mb-s-r-o", "name": "STABO MB s.r.o.", "address": "Pražská 1543 Moravské Budějovice 676 02"}, {"id": "bdj-interiery-s-r-o", "name": "BDJ INTERIÉRY s.r.o.", "address": "Štěchovice 336 Štěchovice 252 07"}, {"id": "mk-parkett-s-r-o", "name": "MK Parkett s.r.o.", "address": "Jiráskova 2042 Benešov 256 01"}, {"id": "jama-cz-s-r-o", "name": "JAMA CZ s.r.o.", "address": "Drachkov 86 Drachkov 386 01"}, {"id": "jaroslav-jirchar", "name": "Jaroslav Jirchář", "address": "Zahradní 334 Roudné 370 07"}, {"id": "bekera-s-r-o", "name": "BEKERA s.r.o.", "address": "Za nádrražím Zliv 373 44"}, {"id": "p-plast-lom-s-r-o", "name": "P-PLAST Lom s.r.o.", "address": "Lom 61 Lom 390 02"}, {"id": "ploty-vlasim-s-r-o", "name": "Ploty Vlašim s.r.o.", "address": "Vlasákova 222 Vlašim 258 01"}, {"id": "martin-kveton-drevoobchod-klatovy", "name": "Martin Květoň ( Dřevoobchod Klatovy )", "address":"Plzeňská 925 Klatovy 339 01"}, {"id": "drevoobchod-k-c-karlovy-vary-a-s", "name": "Dřevoobchod K&C Karlovy Vary, a.s.", "address": "Rosnice 66 Karlovy Vary 360 17"}, {"id": "drevak-k-c-s-r-o", "name": "K&C Dřevoobchod Oldřichov", "address": "Oldřichov 227, 417 24 Oldřichov"}, {"id": "palubky-koten-s-r-o", "name": "PALUBKY KOTEN s.r.o.", "address": "Pávoská 5679/25d Jihlava 586 01"}, {"id": "wpc-centrum-s-r-o-liberec", "name": "WPC centrum s.r.o. - Liberec", "address": "Cyrila a Metoděje 495/2 Liberec 460 01"}, {"id": "aqua-program-s-r-o-vzorova-terasa", "name": "AQUA Program s.r.o. - vzorová terasa", "address": "Ohrazenice 255 Ohrazenice 511 01"}, {"id": "podlahy-blanket-s-r-o", "name": "PODLAHY BLANKET s.r.o.", "address": "Pod Loretou 885 Kosmonosy 293 06"}, {"id": "vladeko-spol-s-r-o", "name": "VLADEKO spol. s r.o.", "address": "Karlštejnská 97 Tachlovice 252 17"}, {"id": "drevak-k-c-s-r-o", "name": "K&C Dřevoobchod Oldřichov", "address": "Oldřichov 227, 417 24 Oldřichov"}, {"id": "drevospektrum-rakovnik-s-r-o", "name": "DŘEVOSPEKTRUM Rakovník s.r.o.", "address": "Lišanská 2760 Rakovník 269 01"}, {"id": "stavebni-sdruzeni-bostik-s-r-o", "name": "Stavební sdružení Boštík s.r.o.", "address": "Poříčí u Litomyšle 117 Poříčí u Litomyšle 570 01"}, {"id": "drevoobchod-ceska-lipa-s-r-o", "name": "DŘEVOOBCHOD - ČESKÁ LÍPA, s. r. o.", "address": "U Obecního lesa 3044 Česká Lípa Dubice 470 01"}, {"id": "drevoobchod-melnik-s-r-o", "name": "Dřevoobchod Mělník s.r.o.", "address": "Nad Oborou 4154 Mělník 576 01"}, {"id": "drevoobchod-premier-vaclav-sladky", "name": "Dřevoobchod Premier Václav Sladký", "address": "Americká 2486/20 Cheb 350 02"}, {"id": "podlahy-a-dvere-s-r-o", "name": "PODLAHY A DVEŘE s.r.o.", "address": "Jičínská 169 Volanov 541 01"}, {"id": "stafikr-spol-s-r-o", "name": "STAFIKR, spol. s.r.o.", "address": "Bratislavská 587/16 Hustopeče 693 01"}, {"id": "translignum-bm-s-r-o", "name": "Translignum BM, s.r.o.", "address": "Návsí 975 Návsí 739 92"}, {"id": "strnad-podlahy-dvere-s-r-o", "name": "STRNAD podlahy, dveře s.r.o.", "address": "Rohovládova Bělá 143 Pardubice 533 43"}, {"id": "petr-vsechovsky-drevotyp", "name": "Petr Všechovský - Dřevotyp", "address": "Netovická 875 Slaný 274 01"}, {"id": "petr-vsechovsky-drevotyp", "name": "Petr Všechovský - Dřevotyp", "address": "Květoslava Mašity 219 Všenory 252 31"}, {"id": "pavel-behavy", "name": "Pavel Běhavý", "address": "Škvorecká 388 Úvaly 250 82"}, {"id": "lm-zelezarstvi-a-hutni-material-s-r-o", "name": "LM - Železářství a hutní materiál s.r.o.", "address": "Zámecká 10 Kunštát na Moravě 679 72"}, {"id": "drevoobchod-k-c-oldrichov", "name": "Dřevoobchod K&C Oldřichov", "address": "Oldřichov 227 Oldřichov 417 24"}, {"id": "df-technik-s-r-o", "name": "DF Technik s.r.o.", "address": "Novohospodská 135 Příbram 261 01"}];</script><script>(function(){function ready(fn){ if(document.readyState!=='loading') fn(); else document.addEventListener('DOMContentLoaded', fn); }function ensureLeaflet(fn){ if(window.L) return fn(); var h=document.head||document.getElementsByTagName('head')[0];var link=document.createElement('link'); link.rel='stylesheet'; link.href='https://unpkg.com/leaflet@1.9.4/dist/leaflet.css'; link.crossOrigin=''; h.appendChild(link);var s=document.createElement('script'); s.src='https://unpkg.com/leaflet@1.9.4/dist/leaflet.js'; s.crossOrigin=''; s.onload=function(){ setTimeout(fn,50); }; h.appendChild(s);setTimeout(fn, 1000);}ready(function(){ensureLeaflet(function(){var mapEl=document.getElementById('leafletMap'); if(!mapEl) return;var map=L.map(mapEl,{scrollWheelZoom:false,dragging:true,tap:true,tapTolerance:25,attributionControl:true});var tiles=L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{maxZoom:19,attribution:'© OpenStreetMap'}).addTo(map);var group=L.featureGroup().addTo(map);var bounds=[]; window._selectedPickupPoint=null;function fit(){ if(bounds.length) map.fitBounds(bounds,{padding:[40,40],maxZoom:8}); else map.setView([49.8,15.5],7); }fit();var retry=0,timer=setInterval(function(){ retry++; map.invalidateSize(); fit(); if(retry>=10) clearInterval(timer); },200);map.once('movestart', function(){ if(timer){ clearInterval(timer); timer=null; } });map.once('zoomstart', function(){ if(timer){ clearInterval(timer); timer=null; } });tiles.on('load', function(){ setTimeout(function(){ map.invalidateSize(); fit(); },120); });var list=window.pickupPointsRaw||[]; var i=0;function addNext(){ if(i>=list.length) return; var p=list[i++];function place(lat,lng){var m=L.circleMarker([lat,lng],{radius:9,weight:2});m.on('mousedown', function(ev){ if(ev.originalEvent && ev.originalEvent.stopPropagation) ev.originalEvent.stopPropagation(); });m.on('click', function(){window._selectedPickupPoint = p;var __v = document.getElementById('pickupPointInput');if(__v){ __v.readOnly=false; __v.value = p.name || ''; try{ __v.dispatchEvent(new Event('input',{bubbles:true})); __v.dispatchEvent(new Event('change',{bubbles:true})); }catch(e){__orderEmailSent = false;} __v.readOnly=true; }var out = document.getElementById('selectedPickupPointDisplay');if(out){ out.innerHTML = 'Vybrané výdejní místo: <strong>' + (p.name || '') + '</strong>'; out.style.display = 'block'; }L.popup().setLatLng([lat,lng]).setContent('<strong>'+p.name+'</strong>').openOn(map);var btn=document.getElementById('confirmPickupBtnModal'); if(btn) btn.disabled=false;});group.addLayer(m); bounds.push([lat,lng]); fit();}var cm = /(-?\d{1,2}\.\d+)[,\s]+(-?\d{1,3}\.\d+)/.exec(p.address||'');if(cm){ place(parseFloat(cm[1]), parseFloat(cm[2])); setTimeout(addNext,50); return; }var url='https://nominatim.openstreetmap.org/search?format=json&q='+encodeURIComponent(p.address)+'&limit=1&addressdetails=0';fetch(url,{headers:{'Accept':'application/json'}}).then(function(r){return r.ok?r.json():[];}).then(function(a){if(Array.isArray(a)&&a.length){ var lat=parseFloat(a[0].lat),lng=parseFloat(a[0].lon); if(!isNaN(lat)&&!isNaN(lng)) place(lat,lng); }}).catch(function(){__orderEmailSent = false;}).finally(function(){ setTimeout(addNext,750); });}addNext();// Override confirmPickupSelection to use selected marker from mapwindow.confirmPickupSelection = function(){var sel = window._selectedPickupPoint;if(!sel){ var inp=document.getElementById('pickupPointInput'); if(inp && inp.value.trim()){ sel={id:'', name:inp.value.trim()}; } else { return; } }var out = document.getElementById('selectedPickupPointDisplay');if(out){ out.innerHTML = 'Vybrané výdejní místo: <strong>' + (sel.name || '') + '</strong>'; out.style.display = 'block'; }var hidId = document.getElementById('orderPickupPointId');var hidName = document.getElementById('orderPickupPointName');if(hidId) hidId.value = sel.id || '';if(hidName) hidName.value = sel.name || '';var vis = document.getElementById('pickupPointInput');if(vis){vis.readOnly = false;vis.value = sel.name || '';try{vis.dispatchEvent(new Event('input', {bubbles:true}));vis.dispatchEvent(new Event('change', {bubbles:true}));}catch(e){__orderEmailSent = false;}vis.readOnly = true;}var txtEl = document.getElementById('pickupSummaryText');if(txtEl){ txtEl.textContent = 'Vybrané výdejní místo: ' + (sel.name || ''); }var sum = document.getElementById('pickupSummary'); if(sum){ sum.style.display = 'block'; }};});});})();// === MODAL + LOGIKA (injected) ===function showMessage(text, type = 'success') {const box = document.getElementById('messageBox') || (function(){const el = document.createElement('div');el.id = 'messageBox';el.className = 'message-box';document.body.appendChild(el);return el;})();box.textContent = text;box.style.backgroundColor = (type === 'error') ? '#dc2626' : '#22c55e';box.style.opacity = '1';setTimeout(() => box.style.opacity = '0', 2400);}function openOrderModal(sourceEmailInputId) {const modal = document.getElementById('orderModal');if (!modal) return;const hidden = document.getElementById('modalEmailSource');if (hidden) hidden.value = sourceEmailInputId || '';modal.classList.add('open');document.body.style.overflow = 'hidden';document.addEventListener('keydown', escCloseHandler);}function closeOrderModal() {const modal = document.getElementById('orderModal');if (!modal) return;modal.classList.remove('open');document.body.style.overflow = '';document.removeEventListener('keydown', escCloseHandler);}function escCloseHandler(e) {if (e.key === 'Escape') closeOrderModal();}function handleCompanyToggle() {const check = document.getElementById('isCompany');const box = document.getElementById('companyFields');if (check && box) {box.classList.toggle('open', !!check.checked);}}function handleSameAddressToggle() {const same = document.getElementById('isSameAddress');const inner = document.getElementById('deliveryFields');const wrapper = document.getElementById('deliverySection');if (!same || !inner || !wrapper) return;if (same.checked) {inner.classList.remove('open');wrapper.classList.remove('open');} else {wrapper.classList.add('open');setTimeout(() => inner.classList.add('open'), 10);}}function handleShippingChange() {}function submitOrderForm() {const name = (document.getElementById('orderName') || {}).value || (document.getElementById('orderContactName') || {}).value || '';const phone = (document.getElementById('orderPhone') || {}).value || (document.getElementById('orderContactPhone') || {}).value || '';if (!name.trim() || !phone.trim()) {showMessage('Doplňte prosím povinné údaje (jméno a telefon).', 'error');return;}showMessage('Objednávka byla odeslána. Ozveme se vám co nejdříve.');closeOrderModal();}document.addEventListener('DOMContentLoaded', () => {const pairs = [['terraceNewButton1', 'contactEmail-terrace'],['terraceNewButton2', 'contactEmail-terrace'],['fence90x13NewButton1', 'contactEmail-90x13'],['fence90x13NewButton2', 'contactEmail-90x13'],['fence150x12NewButton1', 'contactEmail-150x12'],['fence150x12NewButton2', 'contactEmail-150x12'],];pairs.forEach(([btnId, emailId]) => {const btn = document.getElementById(btnId);if (btn) btn.addEventListener('click', () => openOrderModal(emailId));});handleCompanyToggle();handleSameAddressToggle();});// === /MODAL + LOGIKA ===</script><!-- MODAL OBJEDNÁVKY --><div id="orderModal" class="modal-overlay" onclick="if(event.target.id==='orderModal') closeOrderModal();"><div class="modal-content-slide" role="dialog" aria-modal="true" aria-labelledby="orderModalTitle"><div class="flex justify-between items-start mb-6"><h2 id="orderModalTitle" class="text-2xl font-bold text-gray-900">Kontaktní údaje pro závaznou objednávku</h2><button type="button" onclick="closeOrderModal()" class="text-gray-400 hover:text-gray-600 text-4xl font-light leading-none">×</button></div><form id="orderForm"><input type="hidden" id="modalEmailSource" value=""><!-- Firma toggle --><div class="flex items-center pb-4"><input id="isCompany" type="checkbox" onchange="handleCompanyToggle()" class="h-5 w-5 text-stone-800 border-gray-300 rounded focus:ring-stone-800"><label for="isCompany" class="ml-2 block text-base font-medium text-gray-900">Nakupuji na firmu</label></div><br><!-- Firemní pole --><div id="companyFields" class="space-y-4 bg-gray-50 p-4 rounded-lg border border-gray-200 company-fields-animated"><h3 class="text-xl font-semibold text-gray-900">Fakturační údaje (Firma)</h3><div><label for="orderCompanyName" class="block text-sm font-medium text-gray-700">Název společnosti *</label><input type="text" id="orderCompanyName" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md"></div><div><label for="orderICO" class="block text-sm font-medium text-gray-700">IČO *</label><input type="text" id="orderICO" class="mt-1 block w-full px-4 py-2 border border-gray-300 rounded-md"></div><hr class="border-t border-gray-300 mt-4 pt-4"><h3 class="text-lg font-semibold text-gray-800">Kontaktní osoba *</h3><div class="grid grid-cols-1 md:grid-cols-2 gap-6">