62 lines
2.5 KiB
JavaScript
62 lines
2.5 KiB
JavaScript
const pricing = {
|
|
balanced: {
|
|
name: "Balanced",
|
|
description: "A little bit of everything, dialed into a rhythm you can actually keep.",
|
|
prices: [5000, 4000, 2000],
|
|
},
|
|
bulk: {
|
|
name: "Bulk",
|
|
description: "Intentional calories, complex carbs and protein in a bigger, bolder box.",
|
|
prices: [6000, 5000, 2500],
|
|
},
|
|
protein: {
|
|
name: "Protein",
|
|
description: "Pure protein power for the work you put in, from first rep to last.",
|
|
prices: [6500, 5500, 3000],
|
|
},
|
|
lean: {
|
|
name: "Lean",
|
|
description: "Minimal fats. Maximum clarity. Light, clean meals to help you move sharper.",
|
|
prices: [7000, 6000, 3500],
|
|
},
|
|
};
|
|
|
|
const options = [
|
|
{ label: "Breakfast, lunch & dinner", detail: "3 meals a day" },
|
|
{ label: "Lunch & dinner", detail: "2 meals a day" },
|
|
{ label: "Dinner", detail: "1 meal a day" },
|
|
];
|
|
|
|
const mode = new URLSearchParams(window.location.search).get("mode") || "balanced";
|
|
const selected = pricing[mode] || pricing.balanced;
|
|
|
|
document.title = `${selected.name} mode pricing — The Tiffin Food`;
|
|
document.querySelector("#mode-title").textContent = `${selected.name} mode`;
|
|
document.querySelector("#mode-description").textContent = selected.description;
|
|
document.querySelector("#pricing-options").innerHTML = options
|
|
.map((option, index) => `
|
|
<article class="price-card">
|
|
<div>
|
|
<p class="price-index">0${index + 1}</p>
|
|
<h3>${option.label}</h3>
|
|
<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>
|
|
</article>
|
|
`)
|
|
.join("");
|
|
|
|
document.querySelector("#customize-form").addEventListener("submit", (event) => {
|
|
event.preventDefault();
|
|
const form = new FormData(event.currentTarget);
|
|
const subject = `${selected.name} mode — customized tiffin`;
|
|
const body = [
|
|
`Plan: ${selected.name} mode`,
|
|
`Destination: ${form.get("destination")}`,
|
|
`Preferred delivery window: ${form.get("timing")}`,
|
|
`Meal preferences: ${form.get("preferences") || "None specified"}`,
|
|
].join("\n");
|
|
window.location.href = `mailto:hello@thetiffinfood.com?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
|
|
document.querySelector(".form-note").textContent = "Opening your email app with your tiffin preferences.";
|
|
});
|