{"id":1528,"date":"2026-04-09T08:38:24","date_gmt":"2026-04-09T08:38:24","guid":{"rendered":"https:\/\/jashneadab.org\/?page_id=1528"},"modified":"2026-05-06T15:16:52","modified_gmt":"2026-05-06T15:16:52","slug":"1528-2","status":"publish","type":"page","link":"https:\/\/jashneadab.org\/index.php\/1528-2\/","title":{"rendered":"Jashn-e-Adab Sahityotsava"},"content":{"rendered":"\n<div id=\"event-form-wrap\" style=\"max-width:560px;margin:24px auto;padding:20px;border:1px solid #e5e7eb;border-radius:12px;font-family:Arial,sans-serif;background:#fff;\">\n  <h2 style=\"margin:0 0 8px;\">Event Registration<\/h2>\n  <p style=\"margin:0 0 16px;color:#6b7280;\">Fill details to receive WhatsApp updates.<\/p>\n  <form id=\"eventForm\">\n    <label style=\"display:block;margin:10px 0 6px;\">Name *<\/label>\n    <input name=\"name\" type=\"text\" required style=\"width:100%;padding:10px;border:1px solid #d1d5db;border-radius:8px;\" \/>\n    \n    <label style=\"display:block;margin:10px 0 6px;\">Mob No. *<\/label>\n    <input name=\"phone\" type=\"tel\" required placeholder=\"e.g. 9211625495\" style=\"width:100%;padding:10px;border:1px solid #d1d5db;border-radius:8px;\" \/>\n    \n    <label style=\"display:block;margin:10px 0 6px;\">Email<\/label>\n    <input name=\"email\" type=\"email\" style=\"width:100%;padding:10px;border:1px solid #d1d5db;border-radius:8px;\" \/>\n\n    <label style=\"display:block;margin:10px 0 6px;\">Gender *<\/label>\n    <select name=\"gender\" required style=\"width:100%;padding:10px;border:1px solid #d1d5db;border-radius:8px;background:#fff;\">\n      <option value=\"\">Select gender<\/option>\n      <option value=\"Male\">Male<\/option>\n      <option value=\"Female\">Female<\/option>\n      <option value=\"Other\">Other<\/option>\n    <\/select>\n    \n    <label style=\"display:block;margin:10px 0 6px;\">City *<\/label>\n    <select id=\"citySelect\" name=\"city\" required style=\"width:100%;padding:10px;border:1px solid #d1d5db;border-radius:8px;background:#fff;\">\n      <option value=\"\">Loading cities&#8230;<\/option>\n    <\/select>\n    \n    <label style=\"display:block;margin:10px 0 6px;\">Event *<\/label>\n    <select id=\"eventSelect\" name=\"event\" required style=\"width:100%;padding:10px;border:1px solid #d1d5db;border-radius:8px;background:#fff;\">\n      <option value=\"\">Select a city first<\/option>\n    <\/select>\n    <p id=\"noEventsMsg\" style=\"display:none;margin:8px 0 0;font-size:13px;color:#b45309;\">No active events available<\/p>\n\n    <label style=\"display:block;margin:14px 0 6px;\">Where did you get the information from? *<\/label>\n    <select name=\"infoSource\" required style=\"width:100%;padding:10px;border:1px solid #d1d5db;border-radius:8px;background:#fff;\">\n      <option value=\"\">Select<\/option>\n      <option value=\"Facebook\">Facebook<\/option>\n      <option value=\"Instagram\">Instagram<\/option>\n      <option value=\"WhatsApp\">WhatsApp<\/option>\n      <option value=\"Others\">Others<\/option>\n    <\/select>\n    \n    <label style=\"display:flex;gap:8px;align-items:flex-start;margin:14px 0;\">\n      <input type=\"checkbox\" required \/>\n      <span style=\"font-size:14px;color:#374151;\">I agree to receive event updates on WhatsApp.<\/span>\n    <\/label>\n    \n    <button id=\"submitBtn\" type=\"submit\" style=\"width:100%;padding:12px;border:0;border-radius:8px;background:#111827;color:#fff;cursor:pointer;\">\n      Register\n    <\/button>\n  <\/form>\n  <p id=\"formMsg\" style=\"margin:12px 0 0;font-size:14px;\"><\/p>\n<\/div>\n<script>\n  (function () {\n    const APP_BASE = \"https:\/\/wp-whatsapp-app-zeta.vercel.app\";\n    const WEBHOOK_ENDPOINT = APP_BASE + \"\/api\/webhook\/wordpress\";\n    const form = document.getElementById(\"eventForm\");\n    const msg = document.getElementById(\"formMsg\");\n    const btn = document.getElementById(\"submitBtn\");\n    const citySelect = document.getElementById(\"citySelect\");\n    const eventSelect = document.getElementById(\"eventSelect\");\n    const noEventsMsg = document.getElementById(\"noEventsMsg\");\n    \n    function setMsg(text, ok) {\n      msg.style.color = ok ? \"#065f46\" : \"#b91c1c\";\n      msg.textContent = text || \"\";\n    }\n    \n    function resetEventsDropdown(placeholder) {\n      eventSelect.innerHTML = \"\";\n      const opt = document.createElement(\"option\");\n      opt.value = \"\";\n      opt.textContent = placeholder || \"Select\";\n      eventSelect.appendChild(opt);\n    }\n    \n    async function loadCities() {\n      citySelect.innerHTML = '<option value=\"\">Loading cities...<\/option>';\n      try {\n        const res = await fetch(APP_BASE + \"\/api\/cities?active=true\", { method: \"GET\" });\n        const data = await res.json().catch(() => []);\n        if (!res.ok || !Array.isArray(data)) throw new Error(\"Failed to load cities\");\n        citySelect.innerHTML = '<option value=\"\">Select city<\/option>';\n        data.forEach((c) => {\n          const name = c && c.name ? String(c.name) : \"\";\n          if (!name) return;\n          const opt = document.createElement(\"option\");\n          opt.value = name;\n          opt.textContent = name;\n          citySelect.appendChild(opt);\n        });\n        if (citySelect.options.length === 1) {\n          citySelect.innerHTML = '<option value=\"\">No active cities available<\/option>';\n        }\n      } catch (e) {\n        citySelect.innerHTML = '<option value=\"\">Failed to load cities<\/option>';\n      }\n    }\n    \n    async function loadEventsForCity(cityName) {\n      noEventsMsg.style.display = \"none\";\n      resetEventsDropdown(\"Loading events...\");\n      if (!cityName) {\n        resetEventsDropdown(\"Select a city first\");\n        return;\n      }\n      try {\n        const res = await fetch(APP_BASE + \"\/api\/events?city=\" + encodeURIComponent(cityName) + \"&active=true\", { method: \"GET\" });\n        const data = await res.json().catch(() => []);\n        if (!res.ok || !Array.isArray(data)) throw new Error(\"Failed to load events\");\n        resetEventsDropdown(\"Select event\");\n        const list = data.filter((e) => e && e.name);\n        if (list.length === 0) {\n          noEventsMsg.style.display = \"block\";\n          resetEventsDropdown(\"No active events\");\n          return;\n        }\n        list.forEach((ev) => {\n          const opt = document.createElement(\"option\");\n          opt.value = String(ev.name);\n          opt.textContent = String(ev.name);\n          eventSelect.appendChild(opt);\n        });\n      } catch (e) {\n        resetEventsDropdown(\"Failed to load events\");\n      }\n    }\n    \n    citySelect.addEventListener(\"change\", function () {\n      setMsg(\"\", true);\n      loadEventsForCity(citySelect.value);\n    });\n    \n    form.addEventListener(\"submit\", async function (e) {\n      e.preventDefault();\n      setMsg(\"\", true);\n      btn.disabled = true;\n      btn.textContent = \"Submitting...\";\n      const fd = new FormData(form);\n      const payload = {\n        id: \"wp-\" + Date.now(),\n        name: (fd.get(\"name\") || \"\").toString().trim(),\n        phone: (fd.get(\"phone\") || \"\").toString().trim(),\n        email: (fd.get(\"email\") || \"\").toString().trim(),\n        city: (fd.get(\"city\") || \"\").toString().trim(),\n        event: (fd.get(\"event\") || \"\").toString().trim(),\n        gender: (fd.get(\"gender\") || \"\").toString().trim(),\n        infoSource: (fd.get(\"infoSource\") || \"\").toString().trim(),\n        source: \"wordpress_custom_html_form\"\n      };\n      \n      try {\n        const res = await fetch(WEBHOOK_ENDPOINT, {\n          method: \"POST\",\n          headers: {\n            \"Content-Type\": \"application\/json\"\n          },\n          body: JSON.stringify(payload)\n        });\n        const data = await res.json().catch(() => ({}));\n        if (!res.ok || data.success === false) {\n          setMsg(data.error || data.message || \"Submission failed. Please try again.\", false);\n        } else {\n          setMsg(\"Registered successfully. WhatsApp message will be sent shortly.\", true);\n          form.reset();\n          resetEventsDropdown(\"Select a city first\");\n          noEventsMsg.style.display = \"none\";\n          await loadCities();\n        }\n      } catch (err) {\n        setMsg(\"Network error. Please try again.\", false);\n      } finally {\n        btn.disabled = false;\n        btn.textContent = \"Register\";\n      }\n    });\n    \n    \/\/ initial\n    resetEventsDropdown(\"Select a city first\");\n    loadCities();\n  })();\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>Event Registration Fill details to receive WhatsApp updates. Name * Mob No. * Email Gender * Select genderMaleFemaleOther City * Loading cities&#8230; Event * Select a city first No active events available Where did you get the information from? * SelectFacebookInstagramWhatsAppOthers I agree to receive event updates on WhatsApp. Register<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-1528","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/jashneadab.org\/index.php\/wp-json\/wp\/v2\/pages\/1528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jashneadab.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/jashneadab.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/jashneadab.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jashneadab.org\/index.php\/wp-json\/wp\/v2\/comments?post=1528"}],"version-history":[{"count":6,"href":"https:\/\/jashneadab.org\/index.php\/wp-json\/wp\/v2\/pages\/1528\/revisions"}],"predecessor-version":[{"id":1544,"href":"https:\/\/jashneadab.org\/index.php\/wp-json\/wp\/v2\/pages\/1528\/revisions\/1544"}],"wp:attachment":[{"href":"https:\/\/jashneadab.org\/index.php\/wp-json\/wp\/v2\/media?parent=1528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}