Ceownik montażowy z grubej blachy ocynkowanej i powlekanej proszkowo do mocowania płyt podmurówkowych betonowych o wysokości 25 cm bezpośrednio do słupka. W zestawie wkręty montażowe.
Dokument wygenerowany automatycznie na stronie top-fence.eu na podstawie wyboru klienta. Ceny, dostępność i termin realizacji potwierdza Top-Fence Sp. z o.o. w ofercie końcowej. Każdy panel jest ocynkowany; malowanie proszkowe zgodnie z wybranym kolorem RAL.
';
}
function makePdf(c, number) {
return loadLib().then(function () {
var holder = document.createElement('div');
holder.style.cssText = 'position:fixed;left:-10000px;top:0;width:754px;background:#fff;';
holder.innerHTML = offerHtml(c, number);
document.body.appendChild(holder);
var worker = window.html2pdf().set({
margin: [10, 10, 12, 10],
filename: 'Oferta-TopFence-' + number.replace(/\//g, '-') + '.pdf',
image: { type: 'jpeg', quality: 0.95 },
html2canvas: { scale: 2, useCORS: true, backgroundColor: '#ffffff' },
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait', compress: true },
pagebreak: { mode: ['css', 'legacy'] }
}).from(holder.firstChild);
return { worker: worker, cleanup: function () { holder.remove(); } };
});
}
/* ===== AKCJE ===== */
function busy(on) { body.querySelectorAll('.tfc-btn').forEach(function (b) { b.disabled = on; }); }
body.addEventListener('click', function (e) {
var b = e.target.closest('[data-a]'); if (!b) return;
var a = b.getAttribute('data-a'), i = parseInt(b.getAttribute('data-i'), 10), items = getCart();
if (a === 'inc' || a === 'dec' || a === 'del') {
readForm();
if (!items[i]) return;
var q = parseInt(items[i].qty, 10) || 1;
if (a === 'inc') items[i].qty = q + 1;
if (a === 'dec') items[i].qty = Math.max(1, q - 1);
if (a === 'del') items.splice(i, 1);
setCart(items); render(); return;
}
if (a === 'clear') { if (window.confirm('Usunąć wszystkie produkty z koszyka?')) { setCart([]); render(); } return; }
var c = readForm();
if (a === 'pdf') {
var err = validate(c, false); if (err) { msg(err, 'err'); return; }
busy(true); msg('Generuję PDF…');
var n1 = offerNumber();
makePdf(c, n1).then(function (p) { return p.worker.save().then(p.cleanup); })
.then(function () { msg('Oferta PDF została pobrana.', 'ok'); })
.catch(function () { msg('Nie udało się wygenerować PDF. Spróbuj ponownie.', 'err'); })
.then(function () { busy(false); });
}
if (a === 'send') {
var err2 = validate(c, true); if (err2) { msg(err2, 'err'); return; }
busy(true); msg('Wysyłam zapytanie do Top-Fence…');
var n2 = offerNumber(), cleanup = function () {};
makePdf(c, n2).then(function (p) { cleanup = p.cleanup; return p.worker.outputPdf('datauristring'); })
.then(function (pdf) {
cleanup();
return fetch(ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ number: n2, customer: c, items: getCart().map(function (it) { var p = priceFor(it.name); return { name: it.name, qty: parseInt(it.qty, 10) || 1, price: p }; }), website: c.website, pdf: pdf, page: location.href }) });
})
.then(function (r) { return r.json().then(function (j) { return { ok: r.ok, j: j }; }); })
.then(function (res) {
if (res.ok && res.j && res.j.ok) msg('Dziękujemy! Zapytanie nr ' + n2 + ' zostało wysłane do Top-Fence. Skontaktujemy się z Tobą wkrótce.', 'ok');
else msg((res.j && res.j.message) || 'Nie udało się wysłać zapytania. Napisz do nas: ' + COMPANY.email, 'err');
})
.catch(function () { cleanup(); msg('Nie udało się wysłać zapytania. Napisz do nas: ' + COMPANY.email, 'err'); })
.then(function () { busy(false); });
}
});
body.addEventListener('change', function (e) { if (e.target.closest('.tfc-form')) readForm(); });
function updateBadge() {
var b = document.getElementById('tf-cart-badge'), n = count();
b.textContent = String(n); b.style.display = n > 0 ? 'inline-block' : 'none';
}
function open() { render(); drawer.classList.add('tf-open'); overlay.classList.add('tf-open'); document.body.classList.add('tf-cart-open'); }
function close() { drawer.classList.remove('tf-open'); overlay.classList.remove('tf-open'); document.body.classList.remove('tf-cart-open'); }
button.addEventListener('click', function () { drawer.classList.contains('tf-open') ? close() : open(); });
button.addEventListener('keydown', function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); button.click(); } });
drawer.querySelector('.tfc-close').addEventListener('click', close);
overlay.addEventListener('click', close);
document.addEventListener('keydown', function (e) { if (e.key === 'Escape') close(); });
document.addEventListener('tfCartUpdated', updateBadge);
window.addEventListener('storage', function (e) { if (e.key === CART_KEY) updateBadge(); });
window.tfCart = { open: open, close: close, offerHtml: offerHtml, makePdf: makePdf };
/* ===== POZYCJA: przyklejony pod przełącznikiem języka (bez skakania) ===== */
var sizeCss = document.createElement('style'); sizeCss.id = 'tf-cart-size-css';
sizeCss.textContent = 'html body #tf-language-switcher,html body #tf-language-switcher #gt_float_wrapper,html body #tf-language-switcher .gt_float_switcher,html body #tf-language-switcher .gt-selected{width:128px!important;min-width:128px!important;max-width:128px!important;height:34px!important;box-sizing:border-box!important;}' +
'html body #tf-language-switcher .gt-current-lang{height:32px!important;box-sizing:border-box!important;font-size:13px!important;font-weight:700!important;}' +
'html body #tf-language-switcher #tf-cart-button{position:absolute!important;top:calc(100% + 8px)!important;right:0!important;left:auto!important;bottom:auto!important;width:128px!important;min-width:128px!important;height:34px!important;visibility:visible!important;margin:0!important;z-index:1!important;}' +
'html body #tf-language-switcher #gt_float_wrapper{z-index:5!important;}' +
'html body.tf-cart-open #tf-language-switcher #tf-cart-button{visibility:hidden!important;}' +
'.tfd-page .tfd-dia-chip:hover,.tfd-page .tfd-dia-chip:focus,.tfd-page .tfd-dia-chip:active,.tfd-page .tfd-fill-btn:hover,.tfd-page .tfd-fill-btn:focus,.tfd-page .tfd-fill-btn:active{background:transparent!important;border-color:#c49436!important;color:#f5f5f5!important;outline:none!important;box-shadow:none!important;}' +
'.tfd-page .tfd-dia-chip.is-active,.tfd-page .tfd-dia-chip.is-active:hover,.tfd-page .tfd-dia-chip.is-active:focus,.tfd-page .tfd-dia-chip.is-active:active,.tfd-page .tfd-fill-btn.is-active,.tfd-page .tfd-fill-btn.is-active:hover,.tfd-page .tfd-fill-btn.is-active:focus,.tfd-page .tfd-fill-btn.is-active:active{background:#c49436!important;border-color:#c49436!important;color:#050606!important;}' +
'.tfd-page .tfd-add-btn:hover,.tfd-page .tfd-add-btn:focus,.tfd-page .tfd-add-btn:active{background:#c49436!important;border-color:#c49436!important;color:#050606!important;outline:none!important;box-shadow:none!important;}' +
'.tfd-page .tfd-media-nav:focus,.tfd-page .tfd-media-nav:active,.tf-gallery-nav:focus,.tf-gallery-nav:active{background:rgba(5,6,6,.6)!important;border-color:rgba(255,255,255,.45)!important;color:#fff!important;outline:none!important;box-shadow:none!important;}' +
'.tfd-page .tfd-media-nav:hover,.tf-gallery-nav:hover{background:#c49436!important;border-color:#c49436!important;color:#050606!important;}' +
'.tfd-page .tfd-swatch:focus,.tfd-page .tfd-swatch:active{outline:none!important;}' +
'@media (hover:none){.tfd-page .tfd-dia-chip:hover:not(.is-active),.tfd-page .tfd-chip:hover:not(.is-active){border-color:rgba(255,255,255,.3)!important;}}' +
'html body #tf-language-switcher:has(#tf-cart-button:hover) .gt_options{display:none!important;}html body #tf-language-switcher:has(#tf-cart-button:hover) .gt-selected{border-radius:4px!important;}' +
'@media (max-width:921px){html body #tf-language-switcher{transform:translateY(-19px)!important;}html body #tf-language-switcher,html body #tf-language-switcher #gt_float_wrapper,html body #tf-language-switcher .gt_float_switcher,html body #tf-language-switcher .gt-selected,html body #tf-language-switcher #tf-cart-button{width:116px!important;min-width:116px!important;max-width:116px!important;height:32px!important;}html body #tf-language-switcher .gt-current-lang{height:30px!important;padding:0 10px!important;}html body #tf-language-switcher #tf-cart-button{top:calc(100% + 6px)!important;padding:0 10px!important;font-size:13px!important;}}';
(document.head || document.documentElement).appendChild(sizeCss);
function position() {
var sw = document.getElementById('tf-language-switcher');
if (!sw) { if (button.parentNode !== document.body) document.body.appendChild(button); button.style.cssText = 'top:140px;right:20px;visibility:visible'; return; }
if (button.parentNode !== sw) { button.removeAttribute('style'); sw.appendChild(button); }
var dup = document.querySelectorAll('#tf-cart-button');
for (var i = 0; i < dup.length; i++) { if (dup[i] !== button && dup[i].parentNode) dup[i].parentNode.removeChild(dup[i]); }
}
if (window.MutationObserver) { new MutationObserver(function () { if (document.querySelectorAll('#tf-cart-button').length !== 1 || !document.getElementById('tf-language-switcher') || button.parentNode !== document.getElementById('tf-language-switcher')) position(); }).observe(document.documentElement, { childList: true, subtree: true }); }
setInterval(position, 1000);
function init() { position(); updateBadge(); }
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init); else init();
window.addEventListener('load', init);
})();