{"id":39,"date":"2026-02-14T23:08:45","date_gmt":"2026-02-14T22:08:45","guid":{"rendered":"https:\/\/agroogrodnik.pl\/?page_id=39"},"modified":"2026-02-14T23:23:29","modified_gmt":"2026-02-14T22:23:29","slug":"kalkulator","status":"publish","type":"page","link":"https:\/\/agroogrodnik.pl\/index.php\/kalkulator\/","title":{"rendered":"Kalkulator"},"content":{"rendered":"\n<div id=\"veg-area-calculator\" class=\"vegcalc\">\n  <h2 class=\"vegcalc__title\">Kalkulator powierzchni uprawy \u2013 koszyk warzyw<\/h2>\n\n  <!-- KPI -->\n  <div class=\"vegcalc__kpis\">\n    <div class=\"vegcalc__kpi\">\n      <div class=\"vegcalc__kpiLabel\">Pozycji w koszyku<\/div>\n      <div class=\"vegcalc__kpiValue\" id=\"kpiCount\">0<\/div>\n    <\/div>\n    <div class=\"vegcalc__kpi\">\n      <div class=\"vegcalc__kpiLabel\">\u0141\u0105czna powierzchnia<\/div>\n      <div class=\"vegcalc__kpiValue\"><span id=\"kpiArea\">0.00<\/span> m\u00b2<\/div>\n    <\/div>\n    <div class=\"vegcalc__kpi\">\n      <div class=\"vegcalc__kpiLabel\">\u0141\u0105czna d\u0142ugo\u015b\u0107 grz\u0105dek<\/div>\n      <div class=\"vegcalc__kpiValue\" id=\"kpiLen\">\u2014<\/div>\n    <\/div>\n  <\/div>\n\n  <!-- Dodawanie pozycji -->\n  <div class=\"vegcalc__grid vegcalc__grid--4\">\n    <label class=\"vegcalc__field\">\n      <div class=\"vegcalc__label\">Warzywo<\/div>\n      <select id=\"vegSelect\" class=\"vegcalc__control\"><\/select>\n    <\/label>\n\n    <label class=\"vegcalc__field\">\n      <div class=\"vegcalc__label\">kg\/rok<\/div>\n      <input id=\"kgInput\" class=\"vegcalc__control\" type=\"number\" min=\"0\" step=\"0.1\" value=\"10\" \/>\n    <\/label>\n\n    <label class=\"vegcalc__field\">\n      <div class=\"vegcalc__label\">Poziom plonu<\/div>\n      <select id=\"levelInput\" class=\"vegcalc__control\">\n        <option value=\"low\">Konserwatywnie<\/option>\n        <option value=\"mid\" selected>Typowo<\/option>\n        <option value=\"high\">Intensywnie<\/option>\n      <\/select>\n    <\/label>\n\n    <button id=\"addBtn\" class=\"vegcalc__btn vegcalc__btn--primary\" type=\"button\">Dodaj do koszyka<\/button>\n  <\/div>\n\n  <details class=\"vegcalc__details\">\n    <summary class=\"vegcalc__summary\">Ustawienia globalne<\/summary>\n\n    <div class=\"vegcalc__grid vegcalc__grid--3\">\n      <label class=\"vegcalc__field\">\n        <div class=\"vegcalc__label\">Szeroko\u015b\u0107 grz\u0105dki (m)<\/div>\n        <input id=\"bedWidth\" class=\"vegcalc__control\" type=\"number\" min=\"0\" step=\"0.1\" value=\"1.2\" \/>\n      <\/label>\n\n      <label class=\"vegcalc__field\">\n        <div class=\"vegcalc__label\">Domy\u015blne straty (0.15 = 15%)<\/div>\n        <input id=\"defaultLoss\" class=\"vegcalc__control\" type=\"number\" min=\"0\" max=\"0.9\" step=\"0.01\" value=\"0.15\" \/>\n      <\/label>\n\n      <label class=\"vegcalc__field\">\n        <div class=\"vegcalc__label\">Zaokr\u0105glenie (m\u00b2)<\/div>\n        <select id=\"roundMode\" class=\"vegcalc__control\">\n          <option value=\"2\" selected>Do 0.01 m\u00b2<\/option>\n          <option value=\"1\">Do 0.1 m\u00b2<\/option>\n          <option value=\"0\">Do 1 m\u00b2<\/option>\n        <\/select>\n      <\/label>\n    <\/div>\n  <\/details>\n\n  <div class=\"vegcalc__actions\">\n    <button id=\"recalcBtn\" class=\"vegcalc__btn\" type=\"button\">Oblicz \/ od\u015bwie\u017c<\/button>\n    <button id=\"clearBtn\" class=\"vegcalc__btn vegcalc__btn--danger\" type=\"button\">Wyczy\u015b\u0107 koszyk<\/button>\n    <button id=\"exampleBtn\" class=\"vegcalc__btn\" type=\"button\">Wstaw przyk\u0142ad<\/button>\n  <\/div>\n\n  <div class=\"vegcalc__tableWrap\">\n    <table class=\"vegcalc__table\">\n      <thead>\n        <tr>\n          <th>Warzywo<\/th>\n          <th class=\"right\">kg\/rok<\/th>\n          <th>Poziom<\/th>\n          <th class=\"right\">Plon (kg\/m\u00b2\/zbi\u00f3r)<\/th>\n          <th class=\"right\">Cykle\/rok<\/th>\n          <th class=\"right\">Straty<\/th>\n          <th class=\"right\">Plon netto (kg\/m\u00b2\/rok)<\/th>\n          <th class=\"right\">Pow. (m\u00b2)<\/th>\n          <th class=\"center\">Usu\u0144<\/th>\n        <\/tr>\n      <\/thead>\n      <tbody id=\"cartBody\"><\/tbody>\n      <tfoot>\n        <tr>\n          <td colspan=\"7\" class=\"vegcalc__sumLabel\">Suma<\/td>\n          <td id=\"sumArea\" class=\"vegcalc__sumValue right\">0.00<\/td>\n          <td><\/td>\n        <\/tr>\n      <\/tfoot>\n    <\/table>\n  <\/div>\n\n  <div id=\"summary\" class=\"vegcalc__card\"><\/div>\n<\/div>\n\n<style>\n  \/* ========= HARD ISOLATION (motywy WP cz\u0119sto nadpisuj\u0105 input\/select na focus) ========= *\/\n  #veg-area-calculator.vegcalc{\n    color-scheme: light !important;\n    background:#fff !important;\n    color:#111 !important;\n    border:1px solid #ddd;\n    border-radius:16px;\n    padding:16px;\n    max-width:1100px;\n  }\n  #veg-area-calculator.vegcalc *{\n    color-scheme: light !important;\n  }\n\n  \/* Layout *\/\n  #veg-area-calculator .vegcalc__title{ margin:0 0 12px 0; font-weight:900; color:#111 !important; }\n  #veg-area-calculator .vegcalc__grid{ display:grid; gap:12px; }\n  #veg-area-calculator .vegcalc__grid--4{ grid-template-columns: 1.2fr 0.6fr 0.7fr 0.7fr; align-items:end; }\n  #veg-area-calculator .vegcalc__grid--3{ grid-template-columns: 1fr 1fr 1fr; align-items:end; }\n  #veg-area-calculator .vegcalc__field .vegcalc__label{ font-weight:800; margin-bottom:6px; color:#111 !important; }\n  #veg-area-calculator .vegcalc__details{ margin-top:12px; }\n  #veg-area-calculator .vegcalc__summary{ cursor:pointer; font-weight:900; color:#111 !important; }\n\n  \/* KPI *\/\n  #veg-area-calculator .vegcalc__kpis{ display:flex; gap:12px; flex-wrap:wrap; margin-bottom:12px; }\n  #veg-area-calculator .vegcalc__kpi{ border:1px solid #eee; border-radius:14px; padding:10px 12px; min-width:220px; background:#fff !important; color:#111 !important; }\n  #veg-area-calculator .vegcalc__kpiLabel{ font-size:12px; opacity:.75; color:#111 !important; }\n  #veg-area-calculator .vegcalc__kpiValue{ font-size:18px; font-weight:900; margin-top:4px; color:#111 !important; }\n\n  \/* ========= CONTROLS: FORCE readable text on all states ========= *\/\n  #veg-area-calculator .vegcalc__control{\n    width:100%;\n    padding:10px;\n    border-radius:12px;\n    border:1px solid #ccc !important;\n    background:#fff !important;\n    color:#111 !important;\n    caret-color:#111;\n    font: inherit;\n    line-height:1.2;\n    -webkit-text-fill-color:#111 !important;\n    outline: none !important;\n  }\n\n  #veg-area-calculator .vegcalc__control::placeholder{\n    color: rgba(0,0,0,.55) !important;\n    -webkit-text-fill-color: rgba(0,0,0,.55) !important;\n  }\n\n  \/* Focus\/active\/hover states (motywy cz\u0119sto tu psuj\u0105 kolor) *\/\n  #veg-area-calculator .vegcalc__control:hover{\n    background:#fff !important; color:#111 !important; -webkit-text-fill-color:#111 !important;\n    border-color:#999 !important;\n  }\n  #veg-area-calculator .vegcalc__control:focus,\n  #veg-area-calculator .vegcalc__control:active{\n    background:#fff !important; color:#111 !important; -webkit-text-fill-color:#111 !important;\n    border-color:#111 !important;\n    box-shadow: 0 0 0 3px rgba(0,0,0,.18) !important;\n  }\n\n  \/* Select option colors *\/\n  #veg-area-calculator select.vegcalc__control option{\n    background:#fff !important;\n    color:#111 !important;\n  }\n\n  \/* Autofill (Chrome) *\/\n  #veg-area-calculator input.vegcalc__control:-webkit-autofill,\n  #veg-area-calculator input.vegcalc__control:-webkit-autofill:hover,\n  #veg-area-calculator input.vegcalc__control:-webkit-autofill:focus{\n    -webkit-text-fill-color:#111 !important;\n    box-shadow: 0 0 0 1000px #fff inset !important;\n    transition: background-color 9999s ease-in-out 0s;\n  }\n\n  \/* Buttons *\/\n  #veg-area-calculator .vegcalc__actions{ margin-top:12px; display:flex; gap:10px; flex-wrap:wrap; }\n  #veg-area-calculator .vegcalc__btn{\n    padding:12px 14px;\n    border-radius:12px;\n    border:1px solid #cfcfcf !important;\n    background:#fff !important;\n    color:#111 !important;\n    font-weight:900;\n    cursor:pointer;\n    line-height:1;\n    font: inherit;\n    -webkit-text-fill-color:#111 !important;\n  }\n  #veg-area-calculator .vegcalc__btn:hover{ box-shadow:0 6px 18px rgba(0,0,0,.08); }\n  #veg-area-calculator .vegcalc__btn:active{ transform: translateY(1px); }\n  #veg-area-calculator .vegcalc__btn:focus{ outline:none !important; }\n  #veg-area-calculator .vegcalc__btn--primary{\n    background:#111 !important;\n    border-color:#111 !important;\n    color:#fff !important;\n    -webkit-text-fill-color:#fff !important;\n  }\n  #veg-area-calculator .vegcalc__btn--danger{\n    border-color:#d0d0d0 !important;\n  }\n\n  \/* Table *\/\n  #veg-area-calculator .vegcalc__tableWrap{ margin-top:14px; overflow:auto; }\n  #veg-area-calculator .vegcalc__table{\n    width:100%;\n    min-width: 920px;\n    border-collapse: collapse;\n    background:#fff !important;\n    color:#111 !important;\n  }\n  #veg-area-calculator .vegcalc__table th,\n  #veg-area-calculator .vegcalc__table td{\n    padding:10px;\n    border-bottom:1px solid #f0f0f0;\n    color:#111 !important;\n    background:#fff !important;\n  }\n  #veg-area-calculator .vegcalc__table th{ border-bottom:1px solid #e8e8e8; text-align:left; font-weight:900; }\n  #veg-area-calculator .right{ text-align:right; }\n  #veg-area-calculator .center{ text-align:center; }\n  #veg-area-calculator .vegcalc__sumLabel{\n    padding:12px !important; border-top:2px solid #eee !important; font-weight:900;\n  }\n  #veg-area-calculator .vegcalc__sumValue{\n    padding:12px !important; border-top:2px solid #eee !important; font-weight:900;\n  }\n\n  \/* Card *\/\n  #veg-area-calculator .vegcalc__card{\n    margin-top:12px;\n    padding:12px;\n    border:1px solid #eee;\n    border-radius:14px;\n    background:#fff !important;\n    color:#111 !important;\n  }\n\n  @media (max-width: 920px){\n    #veg-area-calculator .vegcalc__grid--4{ grid-template-columns:1fr 1fr; }\n    #veg-area-calculator .vegcalc__grid--3{ grid-template-columns:1fr; }\n  }\n<\/style>\n\n<script>\n  \/\/ Dane orientacyjne (PL). Mo\u017cesz dopisa\u0107 kolejne pozycje w tej samej strukturze.\n  const DATA = [\n    { id:\"marchew\", name:\"Marchew\", yieldLow:2.5, yieldMid:4.0, yieldHigh:6.0, loss:0.15, cycles:1 },\n    { id:\"kapusta_biala\", name:\"Kapusta bia\u0142a\", yieldLow:2.0, yieldMid:3.5, yieldHigh:5.0, loss:0.15, cycles:1 },\n    { id:\"kalafior\", name:\"Kalafior\", yieldLow:1.5, yieldMid:2.8, yieldHigh:4.2, loss:0.18, cycles:1 },\n    { id:\"pomidor\", name:\"Pomidor\", yieldLow:4.0, yieldMid:7.0, yieldHigh:12.0, loss:0.10, cycles:1 },\n    { id:\"papryka\", name:\"Papryka\", yieldLow:2.5, yieldMid:4.5, yieldHigh:8.0, loss:0.12, cycles:1 },\n    { id:\"burak_cwiklowy\", name:\"Burak \u0107wik\u0142owy\", yieldLow:2.0, yieldMid:3.5, yieldHigh:5.0, loss:0.12, cycles:1 },\n    { id:\"salata_maslowa\", name:\"Sa\u0142ata mas\u0142owa\", yieldLow:0.9, yieldMid:1.6, yieldHigh:2.6, loss:0.20, cycles:3 },\n\n    { id:\"ziemniak\", name:\"Ziemniak\", yieldLow:2.0, yieldMid:3.5, yieldHigh:5.0, loss:0.12, cycles:1 },\n    { id:\"cebula\", name:\"Cebula\", yieldLow:1.8, yieldMid:3.0, yieldHigh:4.5, loss:0.15, cycles:1 },\n    { id:\"czosnek\", name:\"Czosnek\", yieldLow:0.8, yieldMid:1.4, yieldHigh:2.2, loss:0.18, cycles:1 },\n    { id:\"por\", name:\"Por\", yieldLow:2.0, yieldMid:3.5, yieldHigh:5.0, loss:0.15, cycles:1 },\n    { id:\"ogorek\", name:\"Og\u00f3rek\", yieldLow:3.0, yieldMid:6.0, yieldHigh:10.0, loss:0.12, cycles:1 },\n    { id:\"cukinia\", name:\"Cukinia\", yieldLow:4.0, yieldMid:8.0, yieldHigh:14.0, loss:0.12, cycles:1 },\n    { id:\"dynia\", name:\"Dynia\", yieldLow:3.0, yieldMid:6.0, yieldHigh:10.0, loss:0.12, cycles:1 },\n    { id:\"brokul\", name:\"Broku\u0142\", yieldLow:1.2, yieldMid:2.2, yieldHigh:3.5, loss:0.18, cycles:1 },\n    { id:\"kalarepa\", name:\"Kalarepa\", yieldLow:1.5, yieldMid:2.6, yieldHigh:4.0, loss:0.15, cycles:1 },\n    { id:\"fasola_szparagowa\", name:\"Fasola szparagowa\", yieldLow:1.2, yieldMid:2.0, yieldHigh:3.0, loss:0.15, cycles:1 },\n    { id:\"rzodkiewka\", name:\"Rzodkiewka\", yieldLow:0.8, yieldMid:1.5, yieldHigh:2.5, loss:0.20, cycles:4 },\n    { id:\"szpinak\", name:\"Szpinak\", yieldLow:0.9, yieldMid:1.6, yieldHigh:2.6, loss:0.22, cycles:2 },\n    { id:\"jarmuz\", name:\"Jarmu\u017c\", yieldLow:1.0, yieldMid:1.8, yieldHigh:3.0, loss:0.22, cycles:2 }\n  ];\n\n  const vegSelect = document.getElementById(\"vegSelect\");\n  const kgInput = document.getElementById(\"kgInput\");\n  const levelInput = document.getElementById(\"levelInput\");\n  const addBtn = document.getElementById(\"addBtn\");\n  const recalcBtn = document.getElementById(\"recalcBtn\");\n  const cartBody = document.getElementById(\"cartBody\");\n  const sumAreaEl = document.getElementById(\"sumArea\");\n  const summaryEl = document.getElementById(\"summary\");\n  const bedWidthEl = document.getElementById(\"bedWidth\");\n  const defaultLossEl = document.getElementById(\"defaultLoss\");\n  const roundModeEl = document.getElementById(\"roundMode\");\n  const clearBtn = document.getElementById(\"clearBtn\");\n  const exampleBtn = document.getElementById(\"exampleBtn\");\n  const kpiCount = document.getElementById(\"kpiCount\");\n  const kpiArea = document.getElementById(\"kpiArea\");\n  const kpiLen = document.getElementById(\"kpiLen\");\n\n  const cart = [];\n\n  function getVegById(id){ return DATA.find(v => v.id === id); }\n  function pickYield(v, level){\n    if(level === \"low\") return v.yieldLow;\n    if(level === \"high\") return v.yieldHigh;\n    return v.yieldMid;\n  }\n  function roundN(x, n){\n    const p = Math.pow(10, n);\n    return Math.round(x * p) \/ p;\n  }\n\n  function fillVegOptions(){\n    const sorted = DATA.slice().sort((a,b) => a.name.localeCompare(b.name, \"pl\"));\n    for(const v of sorted){\n      const opt = document.createElement(\"option\");\n      opt.value = v.id;\n      opt.textContent = v.name;\n      vegSelect.appendChild(opt);\n    }\n    if(DATA.some(v => v.id === \"marchew\")) vegSelect.value = \"marchew\";\n  }\n\n  function renderCart(){\n    cartBody.innerHTML = \"\";\n    cart.forEach((item, idx) => {\n      const v = getVegById(item.vegId);\n      const tr = document.createElement(\"tr\");\n      tr.dataset.index = String(idx);\n\n      tr.innerHTML = `\n        <td>\n          <div style=\"font-weight:900;color:#111;\">${v.name}<\/div>\n          <div style=\"font-size:12px;opacity:.7;color:#111;\">ID: ${v.id}<\/div>\n        <\/td>\n        <td class=\"right\">\n          <input class=\"vegcalc__control\" data-field=\"kg\" type=\"number\" min=\"0\" step=\"0.1\" value=\"${item.kg}\"\n                 style=\"max-width:140px;text-align:right;\">\n        <\/td>\n        <td>\n          <select class=\"vegcalc__control\" data-field=\"level\" style=\"max-width:190px;\">\n            <option value=\"low\" ${item.level===\"low\"?\"selected\":\"\"}>Konserwatywnie<\/option>\n            <option value=\"mid\" ${item.level===\"mid\"?\"selected\":\"\"}>Typowo<\/option>\n            <option value=\"high\" ${item.level===\"high\"?\"selected\":\"\"}>Intensywnie<\/option>\n          <\/select>\n        <\/td>\n        <td class=\"right\" data-out=\"yieldPerM2\">\u2013<\/td>\n        <td class=\"right\">\n          <input class=\"vegcalc__control\" data-field=\"cycles\" type=\"number\" min=\"1\" step=\"1\" value=\"${item.cycles}\"\n                 style=\"max-width:110px;text-align:right;\">\n        <\/td>\n        <td class=\"right\">\n          <input class=\"vegcalc__control\" data-field=\"loss\" type=\"number\" min=\"0\" max=\"0.9\" step=\"0.01\" value=\"${item.loss}\"\n                 style=\"max-width:110px;text-align:right;\">\n        <\/td>\n        <td class=\"right\" data-out=\"netYield\">\u2013<\/td>\n        <td class=\"right\" style=\"font-weight:900;\" data-out=\"area\">\u2013<\/td>\n        <td class=\"center\">\n          <button type=\"button\" class=\"vegcalc__btn\" data-action=\"remove\">Usu\u0144<\/button>\n        <\/td>\n      `;\n\n      tr.addEventListener(\"input\", (e) => {\n        const field = e.target?.dataset?.field;\n        if(!field) return;\n        const i = parseInt(tr.dataset.index, 10);\n\n        if(field === \"kg\") cart[i].kg = Math.max(parseFloat(e.target.value || \"0\"), 0);\n        if(field === \"cycles\") cart[i].cycles = Math.max(parseInt(e.target.value || \"1\", 10), 1);\n        if(field === \"loss\") cart[i].loss = Math.min(Math.max(parseFloat(e.target.value || \"0\"), 0), 0.9);\n        recalc();\n      });\n\n      tr.addEventListener(\"change\", (e) => {\n        const field = e.target?.dataset?.field;\n        if(field !== \"level\") return;\n        const i = parseInt(tr.dataset.index, 10);\n        cart[i].level = e.target.value;\n        recalc();\n      });\n\n      tr.addEventListener(\"click\", (e) => {\n        if(e.target?.dataset?.action !== \"remove\") return;\n        const i = parseInt(tr.dataset.index, 10);\n        cart.splice(i, 1);\n        renderCart();\n        recalc();\n      });\n\n      cartBody.appendChild(tr);\n    });\n  }\n\n  function recalc(){\n    const digits = parseInt(roundModeEl.value, 10);\n    let sumArea = 0;\n\n    [...cartBody.querySelectorAll(\"tr\")].forEach((tr) => {\n      const idx = parseInt(tr.dataset.index, 10);\n      const item = cart[idx];\n      const v = getVegById(item.vegId);\n\n      const y = pickYield(v, item.level);\n      const annual = y * item.cycles;\n      const net = annual * (1 - item.loss);\n      const area = (item.kg > 0 && net > 0) ? (item.kg \/ net) : 0;\n\n      sumArea += area;\n\n      tr.querySelector('[data-out=\"yieldPerM2\"]').textContent = roundN(y, 2).toFixed(2);\n      tr.querySelector('[data-out=\"netYield\"]').textContent = roundN(net, 2).toFixed(2);\n      tr.querySelector('[data-out=\"area\"]').textContent = roundN(area, digits).toFixed(digits);\n    });\n\n    const sumRounded = roundN(sumArea, digits).toFixed(digits);\n    sumAreaEl.textContent = sumRounded;\n\n    const bw = Math.max(parseFloat(bedWidthEl.value || \"0\"), 0);\n    const totalLen = (bw > 0) ? (sumArea \/ bw) : null;\n\n    kpiCount.textContent = String(cart.length);\n    kpiArea.textContent = sumRounded;\n    kpiLen.textContent = totalLen !== null ? `${roundN(totalLen, 2).toFixed(2)} m` : \"\u2014\";\n\n    summaryEl.innerHTML = `\n      <div style=\"font-size:18px;font-weight:900;margin-bottom:8px;color:#111;\">Podsumowanie<\/div>\n      <div style=\"color:#111;\">Pozycji w koszyku: <strong>${cart.length}<\/strong><\/div>\n      <div style=\"color:#111;\">\u0141\u0105czna powierzchnia: <strong>${sumRounded} m\u00b2<\/strong><\/div>\n      ${totalLen !== null\n        ? `<div style=\"color:#111;\">\u0141\u0105czna d\u0142ugo\u015b\u0107 grz\u0105dek: <strong>${roundN(totalLen, 2).toFixed(2)} m<\/strong> (szeroko\u015b\u0107 ${bw} m)<\/div>`\n        : `<div style=\"opacity:.8;color:#111;\">Ustaw szeroko\u015b\u0107 grz\u0105dki > 0, aby policzy\u0107 d\u0142ugo\u015b\u0107 grz\u0105dek.<\/div>`\n      }\n      <div style=\"margin-top:10px;font-size:12px;opacity:.8;color:#111;\">\n        Wynik jest planistyczny. Plony\/straty s\u0105 orientacyjne.\n      <\/div>\n    `;\n  }\n\n  function addToCart(){\n    const vegId = vegSelect.value;\n    const v = getVegById(vegId);\n    if(!v) return;\n\n    const kg = Math.max(parseFloat(kgInput.value || \"0\"), 0);\n    const level = levelInput.value;\n\n    const existing = cart.findIndex(x => x.vegId === vegId && x.level === level);\n    if(existing >= 0){\n      cart[existing].kg = roundN(cart[existing].kg + kg, 2);\n    } else {\n      const fallbackLoss = Math.min(Math.max(parseFloat(defaultLossEl.value || v.loss), 0), 0.9);\n      cart.push({ vegId, kg, level, cycles: v.cycles, loss: Number.isFinite(v.loss) ? v.loss : fallbackLoss });\n    }\n\n    renderCart();\n    recalc();\n  }\n\n  addBtn.addEventListener(\"click\", addToCart);\n  recalcBtn.addEventListener(\"click\", recalc);\n\n  clearBtn.addEventListener(\"click\", () => {\n    cart.length = 0;\n    renderCart();\n    recalc();\n  });\n\n  exampleBtn.addEventListener(\"click\", () => {\n    cart.length = 0;\n    const examples = [\n      { vegId:\"marchew\", kg:100, level:\"mid\" },\n      { vegId:\"kapusta_biala\", kg:80, level:\"mid\" },\n      { vegId:\"kalafior\", kg:30, level:\"mid\" },\n      { vegId:\"pomidor\", kg:60, level:\"mid\" },\n      { vegId:\"papryka\", kg:25, level:\"mid\" },\n      { vegId:\"burak_cwiklowy\", kg:40, level:\"mid\" },\n      { vegId:\"salata_maslowa\", kg:20, level:\"mid\" }\n    ];\n    for(const ex of examples){\n      const v = getVegById(ex.vegId);\n      if(!v) continue;\n      cart.push({ vegId: ex.vegId, kg: ex.kg, level: ex.level, cycles: v.cycles, loss: v.loss });\n    }\n    renderCart();\n    recalc();\n  });\n\n  \/\/ init\n  fillVegOptions();\n  renderCart();\n  recalc();\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>Kalkulator powierzchni uprawy \u2013 koszyk warzyw Pozycji w koszyku 0 \u0141\u0105czna powierzchnia 0.00 m\u00b2 \u0141\u0105czna d\u0142ugo\u015b\u0107 grz\u0105dek \u2014 Warzywo kg\/rok Poziom plonu KonserwatywnieTypowoIntensywnie Dodaj do koszyka Ustawienia globalne Szeroko\u015b\u0107 grz\u0105dki (m) Domy\u015blne straty (0.15 = 15%) Zaokr\u0105glenie (m\u00b2) Do 0.01 m\u00b2Do 0.1 m\u00b2Do 1 m\u00b2 Oblicz \/ od\u015bwie\u017c Wyczy\u015b\u0107 koszyk Wstaw przyk\u0142ad Warzywo kg\/rok Poziom&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"class_list":["post-39","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/agroogrodnik.pl\/index.php\/wp-json\/wp\/v2\/pages\/39","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agroogrodnik.pl\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/agroogrodnik.pl\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/agroogrodnik.pl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/agroogrodnik.pl\/index.php\/wp-json\/wp\/v2\/comments?post=39"}],"version-history":[{"count":5,"href":"https:\/\/agroogrodnik.pl\/index.php\/wp-json\/wp\/v2\/pages\/39\/revisions"}],"predecessor-version":[{"id":47,"href":"https:\/\/agroogrodnik.pl\/index.php\/wp-json\/wp\/v2\/pages\/39\/revisions\/47"}],"wp:attachment":[{"href":"https:\/\/agroogrodnik.pl\/index.php\/wp-json\/wp\/v2\/media?parent=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}