{"id":207,"date":"2025-10-07T18:38:23","date_gmt":"2025-10-07T18:38:23","guid":{"rendered":"https:\/\/www.humandesigndariamaslowska.com\/?page_id=207"},"modified":"2025-11-04T11:32:03","modified_gmt":"2025-11-04T11:32:03","slug":"darmowy-wykres-human-design","status":"publish","type":"page","link":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/darmowy-wykres-human-design\/","title":{"rendered":"GENERUJ WYKRES"},"content":{"rendered":"<h2>Darmowy wykres Human Design<\/h2>\n<form id=\"hd-form\">\n      <input id=\"hd_name\" name=\"name\" placeholder=\"Imi\u0119\" required \/><br \/>\n      <input id=\"hd_email\" name=\"email\" type=\"email\" placeholder=\"Adres e-mail\" required \/><br \/>\n      <input id=\"hd_date\" name=\"date\" type=\"date\" required \/><br \/>\n      <input id=\"hd_time\" name=\"time\" type=\"time\" required \/><br \/>\n      <label for=\"hd_country\">Kraj:<\/label><br \/>\n      <select id=\"hd_country\" name=\"country\" required><option value=\"\">&#8212; Wybierz kraj &#8212;<\/option><option value=\"Poland\">Polska<\/option><option value=\"Germany\">Niemcy<\/option><option value=\"United Kingdom\">Wielka Brytania<\/option><option value=\"France\">Francja<\/option><option value=\"United States\">Stany Zjednoczone<\/option><\/select><br \/>\n      <label for=\"hd_city\">Miasto:<\/label><br \/>\n      <select id=\"hd_city\" name=\"city\" required><option value=\"\">&#8212; Najpierw wybierz kraj &#8212;<\/option><\/select><br \/>\n      <button type=\"submit\">Generuj wykres<\/button><br \/>\n  <\/form>\n<p><script><br \/>\n\/* Endpoint WP *\/<br \/>\nconst WP_ENDPOINT = '\/wp-json\/hd-widget\/v1\/chart';<br \/>\n\/* Lista miast *\/<br \/>\nconst citiesByCountry = {<br \/>\n  \"Poland\": [\"Warszawa\", \"Krak\u00f3w\", \"Wroc\u0142aw\", \"Gda\u0144sk\", \"Pozna\u0144\", \"\u0141\u00f3d\u017a\"],<br \/>\n  \"Germany\": [\"Berlin\", \"Hamburg\", \"Monachium\", \"Kolonia\"],<br \/>\n  \"United Kingdom\": [\"London\", \"Manchester\", \"Liverpool\", \"Birmingham\"],<br \/>\n  \"France\": [\"Paris\", \"Lyon\", \"Marseille\", \"Nice\"],<br \/>\n  \"United States\": [\"New York\", \"Los Angeles\", \"Chicago\", \"Miami\"]\n};<br \/>\n\/* Aktualizacja listy miast *\/<br \/>\ndocument.getElementById(\"hd_country\").addEventListener(\"change\", function() {<br \/>\n  const selected = this.value;<br \/>\n  const citySelect = document.getElementById(\"hd_city\");<br \/>\n  citySelect.innerHTML = '<option value=\"\">-- Wybierz miasto --<\/option>';<br \/>\n  if (citiesByCountry[selected]) {<br \/>\n    citiesByCountry[selected].forEach(city => {<br \/>\n      const opt = document.createElement(\"option\");<br \/>\n      opt.value = city;<br \/>\n      opt.textContent = city;<br \/>\n      citySelect.appendChild(opt);<br \/>\n    });<br \/>\n  }<br \/>\n});<br \/>\n\/* Obs\u0142uga wysy\u0142ki *\/<br \/>\ndocument.getElementById(\"hd-form\").addEventListener(\"submit\", async function(e){<br \/>\n  e.preventDefault();<br \/>\n  const name = document.getElementById(\"hd_name\").value;<br \/>\n  const email = document.getElementById(\"hd_email\").value;<br \/>\n  const date = document.getElementById(\"hd_date\").value;<br \/>\n  const time = document.getElementById(\"hd_time\").value;<br \/>\n  const country = document.getElementById(\"hd_country\").value;<br \/>\n  const city = document.getElementById(\"hd_city\").value;<br \/>\n  if (!name || !email || !date || !time || !city) {<br \/>\n    alert(\"Prosz\u0119 wype\u0142ni\u0107 wszystkie pola.\");<br \/>\n    return;<br \/>\n  }<br \/>\n  const datetime = new Date(`${date}T${time}:00`).toISOString();<br \/>\n  const location = `${city}, ${country}`;<br \/>\n  const payload = {<br \/>\n    name: name,<br \/>\n    email: email,<br \/>\n    date: datetime,<br \/>\n    location: location<br \/>\n  };<br \/>\n  document.getElementById(\"hd_status\").innerText = \"\u23f3 Generuj\u0119 wykres...\";<br \/>\n  try {<br \/>\n    const res = await fetch(WP_ENDPOINT, {<br \/>\n      method: 'POST',<br \/>\n      headers: {'Content-Type': 'application\/json'},<br \/>\n      body: JSON.stringify(payload)<br \/>\n    });<br \/>\n    const json = await res.json();<br \/>\n    if (!res.ok || !json.success) {<br \/>\n      document.getElementById(\"hd_status\").innerText = \"\u274c B\u0142\u0105d po\u0142\u0105czenia z API.\";<br \/>\n      console.error(json);<br \/>\n      return;<br \/>\n    }<br \/>\n    document.getElementById(\"hd_s_<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Darmowy wykres Human Design Kraj: &#8212; Wybierz kraj &#8212;PolskaNiemcyWielka BrytaniaFrancjaStany Zjednoczone Miasto: &#8212; Najpierw wybierz kraj &#8212; Generuj wykres \/* Endpoint WP *\/ const WP_ENDPOINT = '\/wp-json\/hd-widget\/v1\/chart&#8217;; \/* Lista miast *\/ const citiesByCountry = { &#8222;Poland&#8221;: [&#8222;Warszawa&#8221;, &#8222;Krak\u00f3w&#8221;, &#8222;Wroc\u0142aw&#8221;, &#8222;Gda\u0144sk&#8221;, &#8222;Pozna\u0144&#8221;, &#8222;\u0141\u00f3d\u017a&#8221;], &#8222;Germany&#8221;: [&#8222;Berlin&#8221;, &#8222;Hamburg&#8221;, &#8222;Monachium&#8221;, &#8222;Kolonia&#8221;], &#8222;United Kingdom&#8221;: [&#8222;London&#8221;, &#8222;Manchester&#8221;, &#8222;Liverpool&#8221;, &#8222;Birmingham&#8221;], &#8222;France&#8221;: [&#8222;Paris&#8221;, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-207","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/wp-json\/wp\/v2\/pages\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":6,"href":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/wp-json\/wp\/v2\/pages\/207\/revisions"}],"predecessor-version":[{"id":314,"href":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/wp-json\/wp\/v2\/pages\/207\/revisions\/314"}],"wp:attachment":[{"href":"https:\/\/www.humandesigndariamaslowska.com\/index.php\/wp-json\/wp\/v2\/media?parent=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}