1/* script.js — Poshtik Campus: builds the menu cards, then checks every order. */
2
3/* ===== EXERCISE 1 · render the menu from data ===== */
4const poshtikMenu = [
5 { name: "Jonna Rotte Wrap", category: "Wrap", price: 60, isMillet: true,
6 photo: "images/jonna-rotte-wrap.png", alt: "Jonna rotte wrap filled with vegetables",
7 description: "Telangana sorghum-flatbread wrap, loaded with crunchy vegetables." },
8 { name: "Sajja Roti Wrap", category: "Wrap", price: 60, isMillet: true,
9 photo: "images/sajja-roti-wrap.png", alt: "Sajja roti wrap with fresh filling",
10 description: "Pearl-millet flatbread wrap — dense, warm, and filling." },
11 { name: "Ragi Sangati Bowl", category: "Bowl", price: 55, isMillet: true,
12 photo: "images/ragi-sangati-bowl.png", alt: "Ragi sangati bowl served hot",
13 description: "Classic Telangana finger-millet mudde bowl, served hot." },
14 { name: "Ragi Idli Bowl", category: "Bowl", price: 50, isMillet: true,
15 photo: "images/ragi-idli-bowl.jpg", alt: "Bowl of soft ragi idlis",
16 description: "Soft steamed finger-millet idlis with chutney." },
17 { name: "Pesarattu with Sprouts", category: "Dosa", price: 55, isMillet: false,
18 photo: "images/pesarattu-with-sprouts.jpg", alt: "Pesarattu dosa topped with sprouts",
19 description: "Andhra green-gram dosa, topped with fresh sprouts." },
20 { name: "Ulava Charu Protein Bowl", category: "Bowl", price: 70, isMillet: false,
21 photo: "images/ulava-charu-protein-bowl.jpg", alt: "Ulava charu protein bowl",
22 description: "Telangana horse-gram stew over a protein-rich grain bowl." },
23 { name: "Gongura Sprouts Salad", category: "Salad", price: 45, isMillet: false,
24 photo: "images/gongura-sprouts-salad.jpg", alt: "Gongura sprouts salad",
25 description: "Tangy Andhra gongura leaves tossed with mixed sprouts." },
26 { name: "Sprouts Moong Chilla", category: "Chilla", price: 50, isMillet: false,
27 photo: "images/sprouts-moong-chilla.jpg", alt: "Sprouts moong chilla on a plate",
28 description: "Savoury moong pancake studded with sprouts." },
29 { name: "Paneer Protein Bowl", category: "Bowl", price: 80, isMillet: false,
30 photo: "images/paneer-protein-bowl.jpg", alt: "Paneer protein bowl",
31 description: "Grilled paneer cubes over greens and grains." },
32 { name: "Millet Protein Shake", category: "Drink", price: 40, isMillet: true,
33 photo: "images/millet-protein-shake.jpg", alt: "Glass of millet protein shake",
34 description: "Cold millet-and-jaggery protein shake." }
35];
36
37const dishList = document.getElementById("dish-list");
38
39// For each dish, build <article class="dish"> holding img, h3, p, p.
40poshtikMenu.forEach(function (dish) {
41 const card = document.createElement("article");
42 card.className = "dish";
43 const photo = document.createElement("img");
44 photo.src = dish.photo;
45 photo.alt = dish.alt;
46 photo.width = 180;
47 const title = document.createElement("h3");
48 title.textContent = dish.name;
49 const blurb = document.createElement("p");
50 blurb.textContent = dish.description;
51 const price = document.createElement("p");
52 price.textContent = "Price: Rs. " + dish.price;
53 card.append(photo, title, blurb, price); // same order as the old cards
54 dishList.appendChild(card); // nothing shows until the card joins the page
55});
56console.log("dishes rendered: " + poshtikMenu.length);
57