| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Tools - Amrit Dairy</title> |
| <link rel="icon" type="image/x-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🥛</text></svg>"> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> |
| <style> |
| @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap'); |
| |
| * { |
| font-family: 'Poppins', sans-serif; |
| } |
| |
| .glass { |
| background: rgba(255, 255, 255, 0.1); |
| backdrop-filter: blur(10px); |
| border: 1px solid rgba(255, 255, 255, 0.2); |
| } |
| |
| .gradient-text { |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| -webkit-background-clip: text; |
| -webkit-text-fill-color: transparent; |
| background-clip: text; |
| } |
| |
| .milk-gradient { |
| background: linear-gradient(135deg, #fff5e6 0%, #ffd4a3 50%, #ff9a56 100%); |
| } |
| |
| .tool-card { |
| transition: all 0.3s ease; |
| } |
| |
| .tool-card:hover { |
| transform: translateY(-5px); |
| } |
| </style> |
| </head> |
| <body class="bg-gradient-to-br from-purple-50 via-pink-50 to-orange-50 min-h-screen"> |
| |
| <nav class="glass fixed w-full top-0 z-50 px-6 py-4"> |
| <div class="max-w-7xl mx-auto flex justify-between items-center"> |
| <div class="flex items-center space-x-2"> |
| <span class="text-3xl">🥛</span> |
| <span class="text-2xl font-bold gradient-text">Amrit Dairy</span> |
| </div> |
| <div class="hidden md:flex space-x-8"> |
| <a href="index.html" class="text-gray-700 hover:text-purple-600 transition">Home</a> |
| <a href="index.html#products" class="text-gray-700 hover:text-purple-600 transition">Products</a> |
| <a href="tools.html" class="text-gray-700 hover:text-purple-600 transition">Tools</a> |
| <a href="blog.html" class="text-gray-700 hover:text-purple-600 transition">Blog</a> |
| <a href="index.html#quiz" class="text-gray-700 hover:text-purple-600 transition">Quiz</a> |
| <a href="index.html#contact" class="text-gray-700 hover:text-purple-600 transition">Contact</a> |
| </div> |
| <button class="md:hidden"> |
| <i data-feather="menu" class="w-6 h-6"></i> |
| </button> |
| </div> |
| </nav> |
|
|
| |
| <section class="pt-24 pb-12 px-6"> |
| <div class="max-w-4xl mx-auto text-center"> |
| <h1 class="text-5xl font-bold mb-6 gradient-text">Dairy Tools & Calculators</h1> |
| <p class="text-xl text-gray-600">Powerful tools to help you make informed dairy decisions</p> |
| </div> |
| </section> |
|
|
| |
| <section class="px-6 pb-20"> |
| <div class="max-w-7xl mx-auto grid md:grid-cols-2 lg:grid-cols-3 gap-8"> |
| |
| |
| <div class="tool-card bg-white rounded-2xl p-6 shadow-lg"> |
| <div class="bg-purple-100 w-16 h-16 rounded-xl flex items-center justify-center mb-4"> |
| <i data-feather="activity" class="w-8 h-8 text-purple-600"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">BMI Calculator</h3> |
| <p class="text-gray-600 mb-4">Calculate your Body Mass Index to determine healthy weight range</p> |
| <button onclick="openTool('bmi')" class="text-purple-600 font-semibold hover:text-purple-700"> |
| Open Tool → |
| </button> |
| </div> |
|
|
| |
| <div class="tool-card bg-white rounded-2xl p-6 shadow-lg"> |
| <div class="bg-green-100 w-16 h-16 rounded-xl flex items-center justify-center mb-4"> |
| <i data-feather="calculator" class="w-8 h-8 text-green-600"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">Calcium Calculator</h3> |
| <p class="text-gray-600 mb-4">Track your daily calcium intake from dairy and other sources</p> |
| <button onclick="openTool('calcium')" class="text-purple-600 font-semibold hover:text-purple-700"> |
| Open Tool → |
| </button> |
| </div> |
|
|
| |
| <div class="tool-card bg-white rounded-2xl p-6 shadow-lg"> |
| <div class="bg-orange-100 w-16 h-16 rounded-xl flex items-center justify-center mb-4"> |
| <i data-feather="chef-hat" class="w-8 h-8 text-orange-600"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">Recipe Generator</h3> |
| <p class="text-gray-600 mb-4">Get personalized dairy recipes based on available ingredients</p> |
| <button onclick="openTool('recipe')" class="text-purple-600 font-semibold hover:text-purple-700"> |
| Open Tool → |
| </button> |
| </div> |
|
|
| |
| <div class="tool-card bg-white rounded-2xl p-6 shadow-lg"> |
| <div class="bg-blue-100 w-16 h-16 rounded-xl flex items-center justify-center mb-4"> |
| <i data-feather="trending-up" class="w-8 h-8 text-blue-600"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">Milk Consumption Tracker</h3> |
| <p class="text-gray-600 mb-4">Track your family's daily milk consumption and get insights</p> |
| <button onclick="openTool('tracker')" class="text-purple-600 font-semibold hover:text-purple-700"> |
| Open Tool → |
| </button> |
| </div> |
|
|
| |
| <div class="tool-card bg-white rounded-2xl p-6 shadow-lg"> |
| <div class="bg-pink-100 w-16 h-16 rounded-xl flex items-center justify-center mb-4"> |
| <i data-feather="dollar-sign" class="w-8 h-8 text-pink-600"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">Cost Calculator</h3> |
| <p class="text-gray-600 mb-4">Calculate monthly dairy expenses and find savings opportunities</p> |
| <button onclick="openTool('cost')" class="text-purple-600 font-semibold hover:text-purple-700"> |
| Open Tool → |
| </button> |
| </div> |
|
|
| |
| <div class="tool-card bg-white rounded-2xl p-6 shadow-lg"> |
| <div class="bg-indigo-100 w-16 h-16 rounded-xl flex items-center justify-center mb-4"> |
| <i data-feather="bar-chart-2" class="w-8 h-8 text-indigo-600"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-3">Nutrient Analyzer</h3> |
| <p class="text-gray-600 mb-4">Analyze nutritional content of different dairy products</p> |
| <button onclick="openTool('nutrient')" class="text-purple-600 font-semibold hover:text-purple-700"> |
| Open Tool → |
| </button> |
| </div> |
|
|
| </div> |
| </section> |
|
|
| |
| <div id="toolModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center p-6"> |
| <div class="bg-white rounded-2xl max-w-2xl w-full max-h-[90vh] overflow-y-auto"> |
| <div class="p-6 border-b"> |
| <div class="flex justify-between items-center"> |
| <h3 id="toolTitle" class="text-2xl font-bold">Tool Title</h3> |
| <button onclick="closeTool()" class="text-gray-500 hover:text-gray-700"> |
| <i data-feather="x" class="w-6 h-6"></i> |
| </button> |
| </div> |
| </div> |
| <div id="toolContent" class="p-6"> |
| |
| </div> |
| </div> |
| </div> |
|
|
| |
| <footer class="bg-gradient-to-r from-purple-900 to-pink-900 text-white py-12 px-6"> |
| <div class="max-w-7xl mx-auto"> |
| <div class="grid md:grid-cols-4 gap-8 mb-8"> |
| <div> |
| <div class="flex items-center space-x-2 mb-4"> |
| <span class="text-3xl">🥛</span> |
| <span class="text-2xl font-bold">Amrit Dairy</span> |
| </div> |
| <p class="text-purple-200">Fresh, pure, and nutritious dairy products for your family.</p> |
| </div> |
| <div> |
| <h4 class="font-semibold mb-4">Quick Links</h4> |
| <ul class="space-y-2 text-purple-200"> |
| <li><a href="index.html" class="hover:text-white transition">Home</a></li> |
| <li><a href="index.html#products" class="hover:text-white transition">Products</a></li> |
| <li><a href="tools.html" class="hover:text-white transition">Tools</a></li> |
| <li><a href="index.html#contact" class="hover:text-white transition">Contact</a></li> |
| </ul> |
| </div> |
| <div> |
| <h4 class="font-semibold mb-4">Tools</h4> |
| <ul class="space-y-2 text-purple-200"> |
| <li><a href="#" onclick="openTool('bmi')" class="hover:text-white transition">BMI Calculator</a></li> |
| <li><a href="#" onclick="openTool('calcium')" class="hover:text-white transition">Calcium Calculator</a></li> |
| <li><a href="#" onclick="openTool('recipe')" class="hover:text-white transition">Recipe Generator</a></li> |
| <li><a href="#" onclick="openTool('cost')" class="hover:text-white transition">Cost Calculator</a></li> |
| </ul> |
| </div> |
| <div> |
| <h4 class="font-semibold mb-4">Follow Us</h4> |
| <div class="flex space-x-4"> |
| <a href="#" class="bg-purple-800 p-2 rounded-lg hover:bg-purple-700 transition"> |
| <i data-feather="facebook" class="w-5 h-5"></i> |
| </a> |
| <a href="#" class="bg-purple-800 p-2 rounded-lg hover:bg-purple-700 transition"> |
| <i data-feather="twitter" class="w-5 h-5"></i> |
| </a> |
| <a href="#" class="bg-purple-800 p-2 rounded-lg hover:bg-purple-700 transition"> |
| <i data-feather="instagram" class="w-5 h-5"></i> |
| </a> |
| <a href="#" class="bg-purple-800 p-2 rounded-lg hover:bg-purple-700 transition"> |
| <i data-feather="youtube" class="w-5 h-5"></i> |
| </a> |
| </div> |
| </div> |
| </div> |
| <div class="border-t border-purple-800 pt-8 text-center text-purple-200"> |
| <p>© 2024 Amrit Dairy. All rights reserved. Made with ❤️ in India</p> |
| </div> |
| </div> |
| </footer> |
|
|
| <script> |
| feather.replace(); |
| |
| function openTool(toolType) { |
| const modal = document.getElementById('toolModal'); |
| const title = document.getElementById('toolTitle'); |
| const content = document.getElementById('toolContent'); |
| |
| switch(toolType) { |
| case 'bmi': |
| title.textContent = 'BMI Calculator'; |
| content.innerHTML = ` |
| <div class="space-y-4"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Height (cm)</label> |
| <input type="number" id="height" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter height"> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Weight (kg)</label> |
| <input type="number" id="weight" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter weight"> |
| </div> |
| <button onclick="calculateBMI()" class="w-full py-3 bg-purple-600 text-white rounded-lg font-semibold hover:bg-purple-700"> |
| Calculate BMI |
| </button> |
| <div id="bmiResult" class="hidden p-4 bg-purple-50 rounded-lg"> |
| <p class="text-lg">Your BMI: <span id="bmiValue" class="font-bold text-purple-600"></span></p> |
| <p id="bmiCategory" class="mt-2"></p> |
| </div> |
| </div> |
| `; |
| break; |
| |
| case 'calcium': |
| title.textContent = 'Calcium Intake Calculator'; |
| content.innerHTML = ` |
| <div class="space-y-4"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Age Group</label> |
| <select id="ageGroup" class="w-full px-4 py-2 rounded-lg border border-gray-300"> |
| <option value="child">Children (4-8 years)</option> |
| <option value="teen">Teens (9-18 years)</option> |
| <option value="adult">Adults (19-50 years)</option> |
| <option value="senior">Seniors (51+ years)</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Milk consumed today (ml)</label> |
| <input type="number" id="milkAmount" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter amount"> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Yogurt/Curd consumed (g)</label> |
| <input type="number" id="yogurtAmount" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter amount"> |
| </div> |
| <button onclick="calculateCalcium()" class="w-full py-3 bg-green-600 text-white rounded-lg font-semibold hover:bg-green-700"> |
| Calculate Calcium Intake |
| </button> |
| <div id="calciumResult" class="hidden p-4 bg-green-50 rounded-lg"> |
| <p class="text-lg">Daily Calcium: <span id="calciumValue" class="font-bold text-green-600"></span> mg</p> |
| <p class="mt-2"><span id="calciumStatus"></span></p> |
| </div> |
| </div> |
| `; |
| break; |
| |
| case 'recipe': |
| title.textContent = 'Recipe Generator'; |
| content.innerHTML = ` |
| <div class="space-y-4"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Select Main Ingredient</label> |
| <select id="mainIngredient" class="w-full px-4 py-2 rounded-lg border border-gray-300"> |
| <option value="paneer">Paneer</option> |
| <option value="milk">Milk</option> |
| <option value="yogurt">Yogurt</option> |
| <option value="cheese">Cheese</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Meal Type</label> |
| <select id="mealType" class="w-full px-4 py-2 rounded-lg border border-gray-300"> |
| <option value="breakfast">Breakfast</option> |
| <option value="lunch">Lunch</option> |
| <option value="dinner">Dinner</option> |
| <option value="snack">Snack</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Cooking Time</label> |
| <select id="cookingTime" class="w-full px-4 py-2 rounded-lg border border-gray-300"> |
| <option value="15">Under 15 minutes</option> |
| <option value="30">Under 30 minutes</option> |
| <option value="60">Under 1 hour</option> |
| </select> |
| </div> |
| <button onclick="generateRecipe()" class="w-full py-3 bg-orange-600 text-white rounded-lg font-semibold hover:bg-orange-700"> |
| Generate Recipe |
| </button> |
| <div id="recipeResult" class="hidden p-4 bg-orange-50 rounded-lg"> |
| <h4 class="font-bold text-lg mb-2">Suggested Recipe:</h4> |
| <p id="recipeName" class="text-purple-600 font-semibold mb-2"></p> |
| <p id="recipeDescription" class="text-gray-600"></p> |
| </div> |
| </div> |
| `; |
| break; |
| |
| case 'cost': |
| title.textContent = 'Cost Calculator'; |
| content.innerHTML = ` |
| <div class="space-y-4"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Monthly Milk Consumption (L)</label> |
| <input type="number" id="monthlyMilk" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter liters"> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Milk Price per Liter (₹)</label> |
| <input type="number" id="milkPrice" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter price"> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Other Dairy Products (₹/month)</label> |
| <input type="number" id="otherDairy" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter amount"> |
| </div> |
| <button onclick="calculateCost()" class="w-full py-3 bg-pink-600 text-white rounded-lg font-semibold hover:bg-pink-700"> |
| Calculate Monthly Cost |
| </button> |
| <div id="costResult" class="hidden p-4 bg-pink-50 rounded-lg"> |
| <p class="text-lg">Total Monthly Cost: <span id="totalCost" class="font-bold text-pink-600"></span></p> |
| <p class="mt-2">Annual Cost: <span id="annualCost" class="font-bold text-pink-600"></span></p> |
| </div> |
| </div> |
| `; |
| break; |
| |
| case 'tracker': |
| title.textContent = 'Milk Consumption Tracker'; |
| content.innerHTML = ` |
| <div class="space-y-4"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Number of Family Members</label> |
| <input type="number" id="familyMembers" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter count"> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Daily Milk Consumption (L)</label> |
| <input type="number" id="dailyMilk" step="0.5" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter liters"> |
| </div> |
| <button onclick="trackConsumption()" class="w-full py-3 bg-blue-600 text-white rounded-lg font-semibold hover:bg-blue-700"> |
| Track Consumption |
| </button> |
| <div id="trackerResult" class="hidden p-4 bg-blue-50 rounded-lg"> |
| <canvas id="consumptionChart" width="400" height="200"></canvas> |
| <div class="mt-4 grid grid-cols-2 gap-4"> |
| <div> |
| <p class="text-sm text-gray-600">Per Person Daily</p> |
| <p id="perPersonDaily" class="font-bold text-blue-600"></p> |
| </div> |
| <div> |
| <p class="text-sm text-gray-600">Monthly Consumption</p> |
| <p id="monthlyConsumption" class="font-bold text-blue-600"></p> |
| </div> |
| </div> |
| </div> |
| </div> |
| `; |
| break; |
| |
| case 'nutrient': |
| title.textContent = 'Nutrient Analyzer'; |
| content.innerHTML = ` |
| <div class="space-y-4"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Select Dairy Product</label> |
| <select id="dairyProduct" class="w-full px-4 py-2 rounded-lg border border-gray-300"> |
| <option value="milk">Cow Milk</option> |
| <option value="buffalo">Buffalo Milk</option> |
| <option value="paneer">Paneer</option> |
| <option value="yogurt">Yogurt</option> |
| <option value="butter">Butter</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-2">Quantity</label> |
| <input type="number" id="productQuantity" class="w-full px-4 py-2 rounded-lg border border-gray-300" placeholder="Enter amount"> |
| </div> |
| <button onclick="analyzeNutrients()" class="w-full py-3 bg-indigo-600 text-white rounded-lg font-semibold hover:bg-indigo-700"> |
| Analyze Nutrients |
| </button> |
| <div id="nutrientResult" class="hidden p-4 bg-indigo-50 rounded-lg"> |
| <canvas id="nutrientChart" width="400" height="200"></canvas> |
| <div class="mt-4 space-y-2"> |
| <div class="flex justify-between"> |
| <span>Calories:</span> |
| <span id="calories" class="font-bold"></span> |
| </div> |
| <div class="flex justify-between"> |
| <span>Protein:</span> |
| <span id="protein" class="font-bold"></span> |
| </div> |
| <div class="flex justify-between"> |
| <span>Calcium:</span> |
| <span id="calcium" class="font-bold"></span> |
| </div> |
| <div class="flex justify-between"> |
| <span>Fat:</span> |
| <span id="fat" class="font-bold"></span> |
| </div> |
| </div> |
| </div> |
| </div> |
| `; |
| break; |
| } |
| |
| modal.classList.remove('hidden'); |
| feather.replace(); |
| } |
| |
| function closeTool() { |
| document.getElementById('toolModal').classList.add('hidden'); |
| } |
| |
| // Calculator functions |
| function calculateBMI() { |
| const height = document.getElementById('height').value / 100; |
| const weight = document.getElementById('weight').value; |
| const bmi = (weight / (height * height)).toFixed(1); |
| |
| let category = ''; |
| if (bmi < 18.5) category = 'Underweight'; |
| else if (bmi < 25) category = 'Normal weight'; |
| else if (bmi < 30) category = 'Overweight'; |
| else category = 'Obese'; |
| |
| document.getElementById('bmiValue').textContent = bmi; |
| document.getElementById('bmiCategory').textContent = `Category: ${category}`; |
| document.getElementById('bmiResult').classList.remove('hidden'); |
| } |
| |
| function calculateCalcium() { |
| const ageGroup = document.getElementById('ageGroup').value; |
| const milkAmount = document.getElementById('milkAmount').value || 0; |
| const yogurtAmount = document.getElementById('yogurtAmount').value || 0; |
| |
| const calcium = (milkAmount * 0.3) + (yogurtAmount * 0.15); |
| const recommended = ageGroup === 'child' ? 1000 : ageGroup === 'teen' ? 1300 : ageGroup === 'adult' ? 1000 : 1200; |
| |
| document.getElementById('calciumValue').textContent = calcium.toFixed(1); |
| document.getElementById('calciumStatus').textContent = calcium >= recommended ? |
| '✅ Great job! You\'re meeting your daily calcium requirement.' : |
| `⚠️ You need ${recommended - calcium}mg more calcium daily.`; |
| document.getElementById('calciumResult').classList.remove('hidden'); |
| } |
| |
| function generateRecipe() { |
| const ingredient = document.getElementById('mainIngredient').value; |
| const meal = document.getElementById('mealType').value; |
| const time = document.getElementById('cookingTime').value; |
| |
| const recipes = { |
| 'paneer-breakfast': 'Paneer Bhurji', |
| 'paneer-lunch': 'Paneer Tikka Masala', |
| 'paneer-dinner': 'Palak Paneer', |
| 'paneer-snack': 'Paneer Cutlets', |
| 'milk-breakfast': 'Milk Smoothie Bowl', |
| 'milk-lunch': 'Creamy Tomato Soup', |
| 'milk-dinner': 'White Sauce Pasta', |
| 'milk-snack': 'Milk Pudding', |
| 'yogurt-breakfast': 'Yogurt Parfait', |
| 'yogurt-lunch': 'Curd Rice', |
| 'yogurt-dinner': 'Raita', |
| 'yogurt-snack': 'Lassi', |
| 'cheese-breakfast': 'Cheese Omelette', |
| 'cheese-lunch': 'Grilled Cheese Sandwich', |
| 'cheese-dinner': 'Cheese Pizza', |
| 'cheese-snack': 'Cheese Sticks' |
| }; |
| |
| const recipeKey = `${ingredient}-${meal}`; |
| const recipeName = recipes[recipeKey] || 'Special Dish'; |
| |
| document.getElementById('recipeName').textContent = recipeName; |
| document.getElementById('recipeDescription').textContent = |
| `A delicious ${recipeName} recipe that can be prepared in under ${time} minutes. Perfect for ${meal}!`; |
| document.getElementById('recipeResult').classList.remove('hidden'); |
| } |
| |
| function calculateCost() { |
| const milkQty = document.getElementById('monthlyMilk').value || 0; |
| const milkPrice = document.getElementById('milkPrice').value || 0; |
| const otherDairy = document.getElementById('otherDairy').value || 0; |
| |
| const monthlyTotal = (milkQty * milkPrice) + parseFloat(otherDairy); |
| const annualTotal = monthlyTotal * 12; |
| |
| document.getElementById('totalCost').textContent = `₹${monthlyTotal.toFixed(2)}`; |
| document.getElementById('annualCost').textContent = `₹${annualTotal.toFixed(2)}`; |
| document.getElementById('costResult').classList.remove('hidden'); |
| } |
| |
| function trackConsumption() { |
| const members = document.getElementById('familyMembers').value; |
| const dailyMilk = document.getElementById('dailyMilk').value; |
| |
| const perPerson = (dailyMilk / members).toFixed(2); |
| const monthly = (dailyMilk * 30).toFixed(1); |
| |
| document.getElementById('perPersonDaily').textContent = `${perPerson} L`; |
| document.getElementById('monthlyConsumption').textContent = `${monthly} L`; |
| |
| // Create chart |
| const ctx = document.getElementById('consumptionChart').getContext('2d'); |
| new Chart(ctx, { |
| type: 'bar', |
| data: { |
| labels: ['Daily', 'Weekly', 'Monthly'], |
| datasets: [{ |
| label: 'Milk Consumption (Liters)', |
| data: [dailyMilk, dailyMilk * 7, dailyMilk * 30], |
| backgroundColor: 'rgba(59, 130, 246, 0.5)', |
| borderColor: 'rgba(59, 130, 246, 1)', |
| borderWidth: 1 |
| }] |
| }, |
| options: { |
| responsive: true, |
| scales: { |
| y: { |
| beginAtZero: true |
| } |
| } |
| } |
| }); |
| |
| document.getElementById('trackerResult').classList.remove('hidden'); |
| } |
| |
| function analyzeNutrients() { |
| const product = document.getElementById('dairyProduct').value; |
| const quantity = document.getElementById('productQuantity').value || 100; |
| |
| const nutrientData = { |
| 'milk': { calories: 42, protein: 3.4, calcium: 125, fat: 1 }, |
| 'buffalo': { calories: 97, protein: 3.8, calcium: 210, fat: 7 }, |
| 'paneer': { calories: 265, protein: 18, calcium: 480, fat: 20 }, |
| 'yogurt': { calories: 59, protein: 10, calcium: 110, fat: 1.5 }, |
| 'butter': { calories: 717, protein: 0.9, calcium: 24, fat: 81 } |
| }; |
| |
| const data = nutrientData[product]; |
| const factor = quantity / 100; |
| |
| document.getElementById('calories').textContent = `${(data.calories * factor).toFixed(1)} kcal`; |
| document.getElementById('protein').textContent = `${(data.protein * factor).toFixed(1)} g`; |
| document.getElementById('calcium').textContent = `${(data.calcium * factor).toFixed(1)} mg`; |
| document.getElementById('fat').textContent = `${(data.fat * factor).toFixed(1)} g`; |
| |
| // Create chart |
| const ctx = document.getElementById('nutrientChart').getContext('2d'); |
| new Chart(ctx, { |
| type: 'doughnut', |
| data: { |
| labels: ['Protein', 'Fat', 'Carbs'], |
| datasets: [{ |
| data: [data.protein, data.fat, 5], |
| backgroundColor: [ |
| 'rgba(255, 99, 132, 0.5)', |
| 'rgba(54, 162, 235, 0.5)', |
| 'rgba(255, 206, 86, 0.5)' |
| ], |
| borderColor: [ |
| 'rgba(255, 99, 132, 1)', |
| 'rgba(54, 162, 235, 1)', |
| 'rgba(255, 206, 86, 1)' |
| ], |
| borderWidth: 1 |
| }] |
| }, |
| options: { |
| responsive: true |
| } |
| }); |
| |
| document.getElementById('nutrientResult').classList.remove('hidden'); |
| } |
| </script> |
| </body> |
| </html> |
|
|