Enhance customization form with input for box selection and update styles for better usability

This commit is contained in:
Anurag Jangid 2026-10-08 04:57:31 +05:30
parent 5eb16ec8c9
commit b53bf26b2e
4 changed files with 20 additions and 4 deletions

View file

@ -44,11 +44,19 @@ document.querySelector("#pricing-options").innerHTML = options
<p>${option.detail}</p>
</div>
<strong>₹${selected.prices[index].toLocaleString("en-IN")}<span>/ month</span></strong>
<a class="button button-primary" href="mailto:hello@thetiffinfood.com?subject=${encodeURIComponent(`${selected.name} mode — ${option.label}`)}">Choose this box <span>↗</span></a>
<a class="button button-primary choose-box" href="#box" data-box="${option.label} — ₹${selected.prices[index].toLocaleString("en-IN")} / month">Choose this box <span>↗</span></a>
</article>
`)
.join("");
document.querySelectorAll(".choose-box").forEach((button) => {
button.addEventListener("click", () => {
const box = document.querySelector("#box");
box.value = button.dataset.box;
box.focus();
});
});
document.querySelector("#customize-form").addEventListener("submit", (event) => {
event.preventDefault();
const form = new FormData(event.currentTarget);
@ -56,6 +64,7 @@ document.querySelector("#customize-form").addEventListener("submit", (event) =>
"Hi The Tiffin Food! I would like to customize my tiffin.",
"",
`Plan: ${selected.name} mode`,
`Your box: ${form.get("box")}`,
`Destination: ${form.get("destination")}`,
`Preferred delivery window: ${form.get("timing")}`,
`Meal preferences: ${form.get("preferences") || "None specified"}`,