note7 commited on
Commit
1a42683
·
verified ·
1 Parent(s): 3cc8d1f

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +715 -310
  2. prompts.txt +2 -1
index.html CHANGED
@@ -4,96 +4,668 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Menú Saludable para Mayores de 50</title>
7
- <script src="https://cdn.tailwindcss.com"></script>
8
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.28/jspdf.plugin.autotable.min.js"></script>
10
- <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
11
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
12
  <style>
13
- .fade-in {
14
- animation: fadeIn 0.5s ease-in;
 
 
 
15
  }
16
- @keyframes fadeIn {
17
- from { opacity: 0; }
18
- to { opacity: 1; }
 
 
 
19
  }
20
- .nutrition-badge {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  transition: all 0.3s ease;
 
 
 
22
  }
23
- .nutrition-badge:hover {
24
- transform: scale(1.05);
 
25
  }
26
- .recipe-card:hover {
27
- transform: translateY(-5px);
28
- box-shadow: 0 10px 25px rgba(0,0,0,0.1);
 
29
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  .loading-spinner {
31
  border: 5px solid #f3f3f3;
32
- border-top: 5px solid #3b82f6;
33
  border-radius: 50%;
34
  width: 50px;
35
  height: 50px;
36
  animation: spin 1s linear infinite;
37
  margin: 20px auto;
38
  }
 
39
  @keyframes spin {
40
  0% { transform: rotate(0deg); }
41
  100% { transform: rotate(360deg); }
42
  }
43
- .flex-container {
 
 
 
 
 
 
 
 
44
  display: flex;
45
  flex-direction: column;
46
  }
 
47
  @media (min-width: 1024px) {
48
- .flex-container {
49
  flex-direction: row;
50
  }
51
  }
52
- .recipe-grid {
53
- display: flex;
54
- flex-direction: column;
55
- gap: 1.5rem;
 
 
 
 
 
56
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  .calendar-grid {
58
  display: grid;
59
  grid-template-columns: repeat(7, 1fr);
60
- gap: 0.5rem;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
  </style>
63
  </head>
64
- <body class="bg-gray-50 font-sans">
65
- <div class="container mx-auto px-4 py-8">
66
  <!-- Header -->
67
- <header class="text-center mb-12">
68
- <h1 class="text-4xl font-bold text-blue-800 mb-2">Menú Saludable</h1>
69
- <h2 class="text-2xl text-gray-600">Plan de 30 días para mayores de 50 años</h2>
70
- <div class="w-full bg-gradient-to-r from-blue-400 to-teal-400 h-1 mt-4 rounded-full"></div>
71
  </header>
72
 
73
  <!-- Controls -->
74
- <div class="bg-white rounded-xl shadow-md p-6 mb-8">
75
- <div class="flex flex-wrap justify-between items-center gap-4">
76
- <div>
77
- <label class="block text-gray-700 font-medium mb-2">Filtrar por:</label>
78
- <div class="flex gap-2">
79
- <button id="filter-all" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition">Todas</button>
80
- <button id="filter-breakfast" class="px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition">Desayunos</button>
81
- <button id="filter-dinner" class="px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition">Cenas</button>
82
  </div>
83
  </div>
84
- <div class="flex gap-2">
85
- <button id="generate-menu" class="px-4 py-2 bg-yellow-500 text-white rounded-lg hover:bg-yellow-600 transition flex items-center gap-2">
86
  <i class="fas fa-sync-alt"></i> Nuevo Menú
87
  </button>
88
- <button id="shopping-list" class="px-4 py-2 bg-indigo-500 text-white rounded-lg hover:bg-indigo-600 transition flex items-center gap-2">
89
  <i class="fas fa-shopping-basket"></i> Lista de Compra
90
  </button>
91
  </div>
92
- <div class="flex gap-2">
93
- <button id="export-pdf" class="px-4 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600 transition flex items-center gap-2">
94
  <i class="fas fa-file-pdf"></i> PDF
95
  </button>
96
- <button id="export-csv" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition flex items-center gap-2">
97
  <i class="fas fa-file-csv"></i> CSV
98
  </button>
99
  </div>
@@ -101,77 +673,80 @@
101
  </div>
102
 
103
  <!-- Loading State -->
104
- <div id="loading" class="hidden">
105
  <div class="loading-spinner"></div>
106
- <p class="text-center text-gray-600 mt-4">Generando menú saludable...</p>
107
  </div>
108
 
109
  <!-- Main Content -->
110
- <div class="flex-container">
111
  <!-- Calendar View -->
112
- <div id="calendar-view" class="lg:w-1/3 bg-white rounded-xl shadow-md p-6 h-fit lg:sticky lg:top-4 mb-8 lg:mb-0 lg:mr-8">
113
- <h3 class="text-xl font-semibold text-gray-800 mb-4">Calendario del Menú</h3>
114
- <div class="calendar-grid mb-2">
115
- <div class="text-center font-medium text-gray-500 text-sm">L</div>
116
- <div class="text-center font-medium text-gray-500 text-sm">M</div>
117
- <div class="text-center font-medium text-gray-500 text-sm">X</div>
118
- <div class="text-center font-medium text-gray-500 text-sm">J</div>
119
- <div class="text-center font-medium text-gray-500 text-sm">V</div>
120
- <div class="text-center font-medium text-gray-500 text-sm">S</div>
121
- <div class="text-center font-medium text-gray-500 text-sm">D</div>
122
  </div>
123
  <div id="calendar-days" class="calendar-grid">
124
  <!-- Calendar days will be populated here -->
125
  </div>
126
- <div class="mt-6">
127
- <h4 class="font-medium text-gray-700 mb-2">Resumen Nutricional</h4>
128
- <div class="bg-blue-50 rounded-lg p-4">
129
- <div class="flex justify-between mb-2">
130
- <span class="text-gray-600">Calorías promedio:</span>
131
- <span id="avg-calories" class="font-medium">-</span>
132
  </div>
133
- <div class="flex justify-between mb-2">
134
- <span class="text-gray-600">Proteínas promedio:</span>
135
- <span id="avg-protein" class="font-medium">-</span>
136
  </div>
137
- <div class="flex justify-between">
138
- <span class="text-gray-600">Balance nutricional:</span>
139
- <span id="nutrition-score" class="font-medium">-</span>
140
  </div>
141
  </div>
142
  </div>
143
  </div>
144
 
145
  <!-- Recipes List -->
146
- <div id="recipes-container" class="flex-1">
147
- <div id="no-recipes" class="text-center py-12">
148
- <i class="fas fa-utensils text-5xl text-gray-300 mb-4"></i>
149
- <h3 class="text-xl text-gray-500">No hay recetas cargadas</h3>
150
- <p class="text-gray-400 mt-2">Haz clic en "Generar Menú" para comenzar</p>
151
  </div>
152
- <div id="recipes-list" class="recipe-grid">
153
  <!-- Recipe cards will be populated here -->
154
  </div>
155
  </div>
156
  </div>
157
 
158
  <!-- Shopping List Modal -->
159
- <div id="shopping-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
160
- <div class="bg-white rounded-xl p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto">
161
- <div class="flex justify-between items-center mb-4">
162
- <h3 class="text-xl font-semibold text-gray-800">Lista de la Compra</h3>
163
- <button id="close-shopping-modal" class="text-gray-500 hover:text-gray-700">
164
  <i class="fas fa-times"></i>
165
  </button>
166
  </div>
167
  <div id="shopping-list-content">
168
- <p class="text-gray-500">Genera un menú primero para ver la lista de compra</p>
 
 
 
169
  </div>
170
- <div class="mt-6 flex justify-end gap-2">
171
- <button id="print-shopping-list" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition flex items-center gap-2">
172
  <i class="fas fa-print"></i> Imprimir
173
  </button>
174
- <button id="export-shopping-pdf" class="px-4 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600 transition flex items-center gap-2">
175
  <i class="fas fa-file-pdf"></i> PDF
176
  </button>
177
  </div>
@@ -217,7 +792,7 @@
217
  shoppingListBtn.addEventListener('click', showShoppingList);
218
  exportPdfBtn.addEventListener('click', exportToPdf);
219
  exportCsvBtn.addEventListener('click', exportToCsv);
220
- closeShoppingModal.addEventListener('click', () => shoppingModal.classList.add('hidden'));
221
  printShoppingListBtn.addEventListener('click', printShoppingList);
222
  exportShoppingPdfBtn.addEventListener('click', exportShoppingListToPdf);
223
  filterAllBtn.addEventListener('click', () => filterRecipes('all'));
@@ -231,18 +806,18 @@
231
  // Create 30 days (1 month)
232
  for (let i = 1; i <= 30; i++) {
233
  const dayElement = document.createElement('div');
234
- dayElement.className = 'text-center p-2 rounded-lg cursor-pointer border border-gray-200 hover:bg-blue-50 transition';
235
  dayElement.textContent = i;
236
  dayElement.dataset.day = i;
237
 
238
  dayElement.addEventListener('click', () => {
239
  // Remove highlight from all days
240
- document.querySelectorAll('[data-day]').forEach(el => {
241
- el.classList.remove('bg-blue-500', 'text-white');
242
  });
243
 
244
  // Highlight selected day
245
- dayElement.classList.add('bg-blue-500', 'text-white');
246
  selectedDay = i;
247
 
248
  // Filter recipes for this day
@@ -255,8 +830,8 @@
255
 
256
  // Generate monthly menu
257
  async function generateMonthlyMenu() {
258
- loading.classList.remove('hidden');
259
- noRecipes.classList.add('hidden');
260
  recipesList.innerHTML = '';
261
 
262
  try {
@@ -287,7 +862,7 @@
287
  console.error('Error generating menu:', error);
288
  alert('Error al generar el menú. Por favor intenta nuevamente.');
289
  } finally {
290
- loading.classList.add('hidden');
291
  }
292
  }
293
 
@@ -318,14 +893,15 @@
318
 
319
  try {
320
  // Search for recipes
321
- const response = await axios.get(`${API_URL}?${params}`);
 
322
 
323
- if (response.data.hits.length === 0) {
324
  console.warn(`No recipes found for ${mealType}`);
325
  return null;
326
  }
327
 
328
- const recipeData = response.data.hits[0].recipe;
329
 
330
  // Format recipe data for our app
331
  return {
@@ -387,7 +963,7 @@
387
  // Render recipes
388
  function renderRecipes(recipes) {
389
  if (recipes.length === 0) {
390
- noRecipes.classList.remove('hidden');
391
  return;
392
  }
393
 
@@ -395,68 +971,63 @@
395
 
396
  recipes.forEach(recipe => {
397
  const recipeCard = document.createElement('div');
398
- recipeCard.className = 'recipe-card bg-white rounded-xl shadow-md overflow-hidden transition duration-300 fade-in';
399
  recipeCard.dataset.day = recipe.day;
400
  recipeCard.dataset.mealType = recipe.mealType;
401
 
402
  recipeCard.innerHTML = `
403
- <div class="flex flex-col md:flex-row">
404
- <div class="md:w-1/3">
405
- <img class="w-full h-48 object-cover" src="${recipe.image}" alt="${recipe.title}" onerror="this.src='https://via.placeholder.com/400x300?text=Imagen+no+disponible'">
406
- </div>
407
- <div class="p-6 md:w-2/3">
408
- <div class="flex flex-col md:flex-row md:justify-between md:items-start">
409
  <div>
410
- <span class="inline-block px-3 py-1 text-sm font-semibold rounded-full mb-2
411
- ${recipe.mealType === 'breakfast' ? 'bg-green-100 text-green-800' : 'bg-purple-100 text-purple-800'}">
412
  ${recipe.mealType === 'breakfast' ? 'Desayuno' : 'Cena'} - Día ${recipe.day}
413
  </span>
414
- <h3 class="text-xl font-bold text-gray-800 mb-2">${recipe.title}</h3>
415
  </div>
416
- <div class="flex items-center gap-1 mb-2 md:mb-0">
417
- <span class="text-xs text-gray-500">${recipe.servings} porciones</span>
418
- <i class="fas fa-utensils text-gray-400"></i>
419
  </div>
420
  </div>
421
 
422
- <div class="flex flex-wrap gap-2 my-3">
423
- <div class="nutrition-badge bg-red-100 text-red-800 px-3 py-1 rounded-full text-sm flex items-center gap-1">
424
  <i class="fas fa-fire"></i> ${recipe.nutrition.calories} kcal
425
  </div>
426
- <div class="nutrition-badge bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm flex items-center gap-1">
427
  <i class="fas fa-dumbbell"></i> ${recipe.nutrition.protein}g proteína
428
  </div>
429
- <div class="nutrition-badge bg-yellow-100 text-yellow-800 px-3 py-1 rounded-full text-sm flex items-center gap-1">
430
  <i class="fas fa-bread-slice"></i> ${recipe.nutrition.carbs}g carbos
431
  </div>
432
- <div class="nutrition-badge bg-orange-100 text-orange-800 px-3 py-1 rounded-full text-sm flex items-center gap-1">
433
  <i class="fas fa-oil-can"></i> ${recipe.nutrition.fat}g grasas
434
  </div>
435
  </div>
436
 
437
- <div class="mb-4">
438
- <h4 class="font-medium text-gray-700 mb-2">Ingredientes (${recipe.servings} porciones):</h4>
439
- <ul class="grid grid-cols-1 sm:grid-cols-2 gap-1 text-sm text-gray-600">
440
  ${recipe.ingredients.map(ing =>
441
- `<li class="flex items-start">
442
- <i class="fas fa-check-circle text-green-400 mt-1 mr-2 text-xs"></i>
443
  <span>${ing.text}</span>
444
  </li>`
445
  ).join('')}
446
  </ul>
447
  </div>
448
 
449
- <div class="mb-4">
450
- <h4 class="font-medium text-gray-700 mb-2">Instrucciones:</h4>
451
- <div class="text-sm text-gray-600">
452
- <p>Para ver las instrucciones completas, visita el enlace original de la receta.</p>
453
- </div>
454
  </div>
455
 
456
  ${recipe.sourceUrl ? `
457
- <div class="text-sm">
458
- <span class="text-gray-500">Fuente: </span>
459
- <a href="${recipe.sourceUrl}" target="_blank" class="text-blue-500 hover:underline">
460
  ${recipe.sourceName || 'Ver receta original'}
461
  </a>
462
  </div>
@@ -497,9 +1068,9 @@
497
  function showShoppingList() {
498
  if (Object.keys(shoppingList).length === 0) {
499
  shoppingListContent.innerHTML = `
500
- <div class="text-center py-8">
501
- <i class="fas fa-shopping-basket text-4xl text-gray-300 mb-4"></i>
502
- <p class="text-gray-500">Genera un menú primero para ver la lista de compra</p>
503
  </div>
504
  `;
505
  } else {
@@ -528,15 +1099,15 @@
528
 
529
  sortedAisles.forEach(aisle => {
530
  html += `
531
- <div class="mb-6">
532
- <h4 class="font-medium text-lg text-gray-700 mb-3 border-b pb-2">
533
- <i class="fas fa-store-alt text-blue-400 mr-2"></i>${aisle}
534
  </h4>
535
- <ul class="space-y-2">
536
  ${aisles[aisle].map(item => `
537
- <li class="flex justify-between items-center bg-gray-50 px-3 py-2 rounded-lg">
538
- <span class="font-medium">${item.name}</span>
539
- <span class="text-gray-600">${Math.round(item.amount * 10) / 10} ${item.unit}</span>
540
  </li>
541
  `).join('')}
542
  </ul>
@@ -547,7 +1118,7 @@
547
  shoppingListContent.innerHTML = html;
548
  }
549
 
550
- shoppingModal.classList.remove('hidden');
551
  }
552
 
553
  // Helper function to capitalize first letter
@@ -561,10 +1132,12 @@
561
  const originalContent = document.body.innerHTML;
562
 
563
  document.body.innerHTML = `
564
- <div class="p-8">
565
- <h1 class="text-2xl font-bold text-center mb-6">Lista de la Compra</h1>
 
 
566
  ${printContent}
567
- <div class="mt-8 text-center text-sm text-gray-500">
568
  Generado por Menú Saludable para Mayores de 50
569
  </div>
570
  </div>
@@ -582,101 +1155,7 @@
582
  return;
583
  }
584
 
585
- const { jsPDF } = window.jspdf;
586
- const doc = new jsPDF();
587
-
588
- // Title
589
- doc.setFontSize(20);
590
- doc.setTextColor(40, 53, 147);
591
- doc.text('Menú Saludable para Mayores de 50', 105, 20, { align: 'center' });
592
-
593
- doc.setFontSize(12);
594
- doc.setTextColor(0, 0, 0);
595
- doc.text('Plan de 30 días - Comidas bajas en calorías', 105, 28, { align: 'center' });
596
-
597
- // Add line
598
- doc.setDrawColor(66, 165, 245);
599
- doc.setLineWidth(0.5);
600
- doc.line(20, 32, 190, 32);
601
-
602
- let y = 40;
603
- let page = 1;
604
-
605
- // Add each recipe
606
- currentMenu.forEach((recipe, index) => {
607
- // Add new page if needed (except for first item)
608
- if (index > 0 && y > 250) {
609
- doc.addPage();
610
- y = 20;
611
- page++;
612
- }
613
-
614
- // Recipe title
615
- doc.setFontSize(14);
616
- doc.setTextColor(30, 58, 138);
617
- doc.text(`${recipe.mealType === 'breakfast' ? 'Desayuno' : 'Cena'} - Día ${recipe.day}: ${recipe.title}`, 20, y);
618
- y += 8;
619
-
620
- // Nutrition info
621
- doc.setFontSize(10);
622
- doc.setTextColor(0, 0, 0);
623
-
624
- doc.text(`Nutrición por porción: ${recipe.nutrition.calories} kcal | ${recipe.nutrition.protein}g proteína | ${recipe.nutrition.carbs}g carbohidratos | ${recipe.nutrition.fat}g grasas`, 20, y);
625
- y += 8;
626
-
627
- // Ingredients
628
- doc.setFontSize(12);
629
- doc.setTextColor(55, 65, 81);
630
- doc.text('Ingredientes:', 20, y);
631
- y += 6;
632
-
633
- doc.setFontSize(10);
634
- recipe.ingredients.forEach(ing => {
635
- if (y > 270) {
636
- doc.addPage();
637
- y = 20;
638
- page++;
639
- }
640
-
641
- doc.text(`- ${ing.text}`, 25, y);
642
- y += 6;
643
- });
644
-
645
- y += 6;
646
-
647
- // Instructions
648
- doc.setFontSize(12);
649
- doc.setTextColor(55, 65, 81);
650
- doc.text('Instrucciones:', 20, y);
651
- y += 6;
652
-
653
- doc.setFontSize(10);
654
- const lines = doc.splitTextToSize('Para ver las instrucciones completas, visita el enlace original de la receta.', 170);
655
-
656
- lines.forEach(line => {
657
- if (y > 270) {
658
- doc.addPage();
659
- y = 20;
660
- page++;
661
- }
662
-
663
- doc.text(line, 25, y);
664
- y += 6;
665
- });
666
-
667
- y += 10;
668
-
669
- // Add separator if not last item
670
- if (index < currentMenu.length - 1) {
671
- doc.setDrawColor(200, 200, 200);
672
- doc.setLineWidth(0.2);
673
- doc.line(20, y, 190, y);
674
- y += 5;
675
- }
676
- });
677
-
678
- // Save the PDF
679
- doc.save('menu-saludable-30-dias.pdf');
680
  }
681
 
682
  // Export to CSV
@@ -713,81 +1192,7 @@
713
  return;
714
  }
715
 
716
- const { jsPDF } = window.jspdf;
717
- const doc = new jsPDF();
718
-
719
- // Title
720
- doc.setFontSize(20);
721
- doc.setTextColor(40, 53, 147);
722
- doc.text('Lista de la Compra', 105, 20, { align: 'center' });
723
-
724
- doc.setFontSize(12);
725
- doc.setTextColor(0, 0, 0);
726
- doc.text('Menú Saludable para Mayores de 50 - 30 días', 105, 28, { align: 'center' });
727
-
728
- // Add line
729
- doc.setDrawColor(66, 165, 245);
730
- doc.setLineWidth(0.5);
731
- doc.line(20, 32, 190, 32);
732
-
733
- // Group by aisle
734
- const aisles = {};
735
-
736
- Object.entries(shoppingList).forEach(([name, data]) => {
737
- const aisle = data.aisle || 'Otros';
738
-
739
- if (!aisles[aisle]) {
740
- aisles[aisle] = [];
741
- }
742
-
743
- aisles[aisle].push({
744
- name: capitalizeFirstLetter(name),
745
- amount: data.amount,
746
- unit: data.unit
747
- });
748
- });
749
-
750
- // Sort aisles alphabetically
751
- const sortedAisles = Object.keys(aisles).sort();
752
-
753
- let y = 40;
754
- let page = 1;
755
-
756
- // Add each aisle
757
- sortedAisles.forEach((aisle, aisleIndex) => {
758
- // Add new page if needed (except for first item)
759
- if (aisleIndex > 0 && y > 250) {
760
- doc.addPage();
761
- y = 20;
762
- page++;
763
- }
764
-
765
- // Aisle title
766
- doc.setFontSize(14);
767
- doc.setTextColor(30, 58, 138);
768
- doc.text(aisle, 20, y);
769
- y += 8;
770
-
771
- // Items
772
- doc.setFontSize(12);
773
- doc.setTextColor(0, 0, 0);
774
-
775
- aisles[aisle].forEach((item, itemIndex) => {
776
- if (itemIndex > 0 && y > 270) {
777
- doc.addPage();
778
- y = 20;
779
- page++;
780
- }
781
-
782
- doc.text(`${item.name}: ${Math.round(item.amount * 10) / 10} ${item.unit}`, 25, y);
783
- y += 7;
784
- });
785
-
786
- y += 5;
787
- });
788
-
789
- // Save the PDF
790
- doc.save('lista-compra-menu-saludable.pdf');
791
  }
792
 
793
  // Update nutrition summary
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Menú Saludable para Mayores de 50</title>
 
 
 
 
7
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
  <style>
9
+ /* Reset y estilos base */
10
+ * {
11
+ margin: 0;
12
+ padding: 0;
13
+ box-sizing: border-box;
14
  }
15
+
16
+ body {
17
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
18
+ background-color: #f8f9fa;
19
+ color: #333;
20
+ line-height: 1.6;
21
  }
22
+
23
+ .container {
24
+ width: 100%;
25
+ max-width: 1200px;
26
+ margin: 0 auto;
27
+ padding: 20px;
28
+ }
29
+
30
+ /* Header */
31
+ .header {
32
+ text-align: center;
33
+ margin-bottom: 30px;
34
+ }
35
+
36
+ .header h1 {
37
+ font-size: 2.5rem;
38
+ color: #1a365d;
39
+ margin-bottom: 10px;
40
+ }
41
+
42
+ .header h2 {
43
+ font-size: 1.5rem;
44
+ color: #4a5568;
45
+ }
46
+
47
+ .header-line {
48
+ width: 100%;
49
+ height: 2px;
50
+ background: linear-gradient(to right, #4299e1, #38b2ac);
51
+ margin-top: 20px;
52
+ border-radius: 2px;
53
+ }
54
+
55
+ /* Controles */
56
+ .controls {
57
+ background-color: white;
58
+ border-radius: 10px;
59
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
60
+ padding: 20px;
61
+ margin-bottom: 30px;
62
+ }
63
+
64
+ .controls-container {
65
+ display: flex;
66
+ flex-wrap: wrap;
67
+ justify-content: space-between;
68
+ align-items: center;
69
+ gap: 15px;
70
+ }
71
+
72
+ .filter-group {
73
+ display: flex;
74
+ flex-direction: column;
75
+ }
76
+
77
+ .filter-label {
78
+ font-weight: 500;
79
+ color: #4a5568;
80
+ margin-bottom: 8px;
81
+ }
82
+
83
+ .filter-buttons {
84
+ display: flex;
85
+ gap: 10px;
86
+ }
87
+
88
+ .button {
89
+ padding: 8px 16px;
90
+ border-radius: 8px;
91
+ border: none;
92
+ font-weight: 500;
93
+ cursor: pointer;
94
  transition: all 0.3s ease;
95
+ display: flex;
96
+ align-items: center;
97
+ gap: 8px;
98
  }
99
+
100
+ .button:hover {
101
+ transform: translateY(-2px);
102
  }
103
+
104
+ .button-all {
105
+ background-color: #4299e1;
106
+ color: white;
107
  }
108
+
109
+ .button-all:hover {
110
+ background-color: #3182ce;
111
+ }
112
+
113
+ .button-breakfast {
114
+ background-color: #48bb78;
115
+ color: white;
116
+ }
117
+
118
+ .button-breakfast:hover {
119
+ background-color: #38a169;
120
+ }
121
+
122
+ .button-dinner {
123
+ background-color: #9f7aea;
124
+ color: white;
125
+ }
126
+
127
+ .button-dinner:hover {
128
+ background-color: #805ad5;
129
+ }
130
+
131
+ .button-generate {
132
+ background-color: #ed8936;
133
+ color: white;
134
+ }
135
+
136
+ .button-generate:hover {
137
+ background-color: #dd6b20;
138
+ }
139
+
140
+ .button-shopping {
141
+ background-color: #667eea;
142
+ color: white;
143
+ }
144
+
145
+ .button-shopping:hover {
146
+ background-color: #5a67d8;
147
+ }
148
+
149
+ .button-pdf {
150
+ background-color: #f56565;
151
+ color: white;
152
+ }
153
+
154
+ .button-pdf:hover {
155
+ background-color: #e53e3e;
156
+ }
157
+
158
+ .button-csv {
159
+ background-color: #38a169;
160
+ color: white;
161
+ }
162
+
163
+ .button-csv:hover {
164
+ background-color: #2f855a;
165
+ }
166
+
167
+ /* Loading */
168
+ .loading {
169
+ display: none;
170
+ flex-direction: column;
171
+ align-items: center;
172
+ }
173
+
174
  .loading-spinner {
175
  border: 5px solid #f3f3f3;
176
+ border-top: 5px solid #4299e1;
177
  border-radius: 50%;
178
  width: 50px;
179
  height: 50px;
180
  animation: spin 1s linear infinite;
181
  margin: 20px auto;
182
  }
183
+
184
  @keyframes spin {
185
  0% { transform: rotate(0deg); }
186
  100% { transform: rotate(360deg); }
187
  }
188
+
189
+ .loading-text {
190
+ text-align: center;
191
+ color: #4a5568;
192
+ margin-top: 10px;
193
+ }
194
+
195
+ /* Contenido principal */
196
+ .main-content {
197
  display: flex;
198
  flex-direction: column;
199
  }
200
+
201
  @media (min-width: 1024px) {
202
+ .main-content {
203
  flex-direction: row;
204
  }
205
  }
206
+
207
+ /* Calendario */
208
+ .calendar {
209
+ width: 100%;
210
+ background-color: white;
211
+ border-radius: 10px;
212
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
213
+ padding: 20px;
214
+ margin-bottom: 20px;
215
  }
216
+
217
+ @media (min-width: 1024px) {
218
+ .calendar {
219
+ width: 30%;
220
+ margin-bottom: 0;
221
+ margin-right: 20px;
222
+ position: sticky;
223
+ top: 20px;
224
+ align-self: flex-start;
225
+ }
226
+ }
227
+
228
+ .calendar-title {
229
+ font-size: 1.25rem;
230
+ font-weight: 600;
231
+ color: #2d3748;
232
+ margin-bottom: 15px;
233
+ }
234
+
235
  .calendar-grid {
236
  display: grid;
237
  grid-template-columns: repeat(7, 1fr);
238
+ gap: 8px;
239
+ margin-bottom: 10px;
240
+ }
241
+
242
+ .calendar-day-header {
243
+ text-align: center;
244
+ font-weight: 500;
245
+ color: #718096;
246
+ font-size: 0.875rem;
247
+ }
248
+
249
+ .calendar-day {
250
+ text-align: center;
251
+ padding: 8px;
252
+ border-radius: 8px;
253
+ border: 1px solid #e2e8f0;
254
+ cursor: pointer;
255
+ transition: all 0.3s ease;
256
+ }
257
+
258
+ .calendar-day:hover {
259
+ background-color: #ebf8ff;
260
+ }
261
+
262
+ .calendar-day.selected {
263
+ background-color: #4299e1;
264
+ color: white;
265
+ border-color: #4299e1;
266
+ }
267
+
268
+ .nutrition-summary {
269
+ margin-top: 20px;
270
+ }
271
+
272
+ .nutrition-title {
273
+ font-weight: 500;
274
+ color: #4a5568;
275
+ margin-bottom: 10px;
276
+ }
277
+
278
+ .nutrition-card {
279
+ background-color: #ebf8ff;
280
+ border-radius: 8px;
281
+ padding: 15px;
282
+ }
283
+
284
+ .nutrition-item {
285
+ display: flex;
286
+ justify-content: space-between;
287
+ margin-bottom: 8px;
288
+ }
289
+
290
+ .nutrition-label {
291
+ color: #4a5568;
292
+ }
293
+
294
+ .nutrition-value {
295
+ font-weight: 500;
296
+ }
297
+
298
+ /* Recetas */
299
+ .recipes-container {
300
+ flex: 1;
301
+ }
302
+
303
+ .no-recipes {
304
+ text-align: center;
305
+ padding: 40px 0;
306
+ }
307
+
308
+ .no-recipes-icon {
309
+ font-size: 3rem;
310
+ color: #e2e8f0;
311
+ margin-bottom: 15px;
312
+ }
313
+
314
+ .no-recipes-title {
315
+ font-size: 1.25rem;
316
+ color: #718096;
317
+ margin-bottom: 10px;
318
+ }
319
+
320
+ .no-recipes-text {
321
+ color: #a0aec0;
322
+ }
323
+
324
+ .recipes-list {
325
+ display: flex;
326
+ flex-direction: column;
327
+ gap: 20px;
328
+ }
329
+
330
+ /* Tarjeta de receta */
331
+ .recipe-card {
332
+ background-color: white;
333
+ border-radius: 10px;
334
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
335
+ overflow: hidden;
336
+ transition: all 0.3s ease;
337
+ }
338
+
339
+ .recipe-card:hover {
340
+ transform: translateY(-5px);
341
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
342
+ }
343
+
344
+ .recipe-content {
345
+ display: flex;
346
+ flex-direction: column;
347
+ }
348
+
349
+ @media (min-width: 768px) {
350
+ .recipe-content {
351
+ flex-direction: row;
352
+ }
353
+ }
354
+
355
+ .recipe-image {
356
+ width: 100%;
357
+ height: 200px;
358
+ object-fit: cover;
359
+ }
360
+
361
+ @media (min-width: 768px) {
362
+ .recipe-image {
363
+ width: 33.333%;
364
+ height: auto;
365
+ }
366
+ }
367
+
368
+ .recipe-details {
369
+ padding: 20px;
370
+ flex: 1;
371
+ }
372
+
373
+ .recipe-header {
374
+ display: flex;
375
+ flex-direction: column;
376
+ margin-bottom: 15px;
377
+ }
378
+
379
+ @media (min-width: 768px) {
380
+ .recipe-header {
381
+ flex-direction: row;
382
+ justify-content: space-between;
383
+ align-items: flex-start;
384
+ }
385
+ }
386
+
387
+ .recipe-tag {
388
+ display: inline-block;
389
+ padding: 4px 12px;
390
+ font-size: 0.875rem;
391
+ font-weight: 600;
392
+ border-radius: 999px;
393
+ margin-bottom: 10px;
394
+ }
395
+
396
+ .tag-breakfast {
397
+ background-color: #c6f6d5;
398
+ color: #22543d;
399
+ }
400
+
401
+ .tag-dinner {
402
+ background-color: #e9d8fd;
403
+ color: #44337a;
404
+ }
405
+
406
+ .recipe-title {
407
+ font-size: 1.25rem;
408
+ font-weight: 700;
409
+ color: #2d3748;
410
+ margin-bottom: 5px;
411
+ }
412
+
413
+ .recipe-servings {
414
+ display: flex;
415
+ align-items: center;
416
+ gap: 5px;
417
+ font-size: 0.875rem;
418
+ color: #718096;
419
+ }
420
+
421
+ .nutrition-badges {
422
+ display: flex;
423
+ flex-wrap: wrap;
424
+ gap: 8px;
425
+ margin: 15px 0;
426
+ }
427
+
428
+ .nutrition-badge {
429
+ padding: 6px 12px;
430
+ border-radius: 999px;
431
+ font-size: 0.75rem;
432
+ font-weight: 500;
433
+ display: flex;
434
+ align-items: center;
435
+ gap: 5px;
436
+ }
437
+
438
+ .badge-calories {
439
+ background-color: #fed7d7;
440
+ color: #822727;
441
+ }
442
+
443
+ .badge-protein {
444
+ background-color: #bee3f8;
445
+ color: #2a4365;
446
+ }
447
+
448
+ .badge-carbs {
449
+ background-color: #feebc8;
450
+ color: #7b341e;
451
+ }
452
+
453
+ .badge-fat {
454
+ background-color: #fed7e2;
455
+ color: #702459;
456
+ }
457
+
458
+ .ingredients-title {
459
+ font-weight: 500;
460
+ color: #4a5568;
461
+ margin-bottom: 10px;
462
+ }
463
+
464
+ .ingredients-list {
465
+ display: grid;
466
+ grid-template-columns: 1fr;
467
+ gap: 8px;
468
+ font-size: 0.875rem;
469
+ color: #4a5568;
470
+ }
471
+
472
+ @media (min-width: 480px) {
473
+ .ingredients-list {
474
+ grid-template-columns: 1fr 1fr;
475
+ }
476
+ }
477
+
478
+ .ingredient-item {
479
+ display: flex;
480
+ align-items: flex-start;
481
+ }
482
+
483
+ .ingredient-icon {
484
+ color: #48bb78;
485
+ margin-right: 8px;
486
+ font-size: 0.75rem;
487
+ margin-top: 3px;
488
+ }
489
+
490
+ .instructions-title {
491
+ font-weight: 500;
492
+ color: #4a5568;
493
+ margin: 15px 0 10px;
494
+ }
495
+
496
+ .instructions-text {
497
+ font-size: 0.875rem;
498
+ color: #4a5568;
499
+ }
500
+
501
+ .recipe-source {
502
+ font-size: 0.875rem;
503
+ margin-top: 15px;
504
+ }
505
+
506
+ .source-label {
507
+ color: #718096;
508
+ }
509
+
510
+ .source-link {
511
+ color: #4299e1;
512
+ text-decoration: none;
513
+ }
514
+
515
+ .source-link:hover {
516
+ text-decoration: underline;
517
+ }
518
+
519
+ /* Modal de lista de compra */
520
+ .modal {
521
+ position: fixed;
522
+ top: 0;
523
+ left: 0;
524
+ right: 0;
525
+ bottom: 0;
526
+ background-color: rgba(0, 0, 0, 0.5);
527
+ display: none;
528
+ align-items: center;
529
+ justify-content: center;
530
+ z-index: 1000;
531
+ }
532
+
533
+ .modal-content {
534
+ background-color: white;
535
+ border-radius: 10px;
536
+ width: 90%;
537
+ max-width: 700px;
538
+ max-height: 90vh;
539
+ overflow-y: auto;
540
+ padding: 20px;
541
+ }
542
+
543
+ .modal-header {
544
+ display: flex;
545
+ justify-content: space-between;
546
+ align-items: center;
547
+ margin-bottom: 20px;
548
+ }
549
+
550
+ .modal-title {
551
+ font-size: 1.25rem;
552
+ font-weight: 600;
553
+ color: #2d3748;
554
+ }
555
+
556
+ .close-modal {
557
+ color: #718096;
558
+ font-size: 1.5rem;
559
+ cursor: pointer;
560
+ }
561
+
562
+ .shopping-empty {
563
+ text-align: center;
564
+ padding: 40px 0;
565
+ }
566
+
567
+ .shopping-empty-icon {
568
+ font-size: 3rem;
569
+ color: #e2e8f0;
570
+ margin-bottom: 15px;
571
+ }
572
+
573
+ .shopping-empty-text {
574
+ color: #718096;
575
+ }
576
+
577
+ .aisle-section {
578
+ margin-bottom: 25px;
579
+ }
580
+
581
+ .aisle-title {
582
+ font-weight: 500;
583
+ font-size: 1.125rem;
584
+ color: #2d3748;
585
+ margin-bottom: 15px;
586
+ padding-bottom: 8px;
587
+ border-bottom: 1px solid #e2e8f0;
588
+ }
589
+
590
+ .aisle-icon {
591
+ color: #4299e1;
592
+ margin-right: 8px;
593
+ }
594
+
595
+ .shopping-list {
596
+ display: flex;
597
+ flex-direction: column;
598
+ gap: 10px;
599
+ }
600
+
601
+ .shopping-item {
602
+ display: flex;
603
+ justify-content: space-between;
604
+ align-items: center;
605
+ background-color: #f8fafc;
606
+ padding: 12px 15px;
607
+ border-radius: 8px;
608
+ }
609
+
610
+ .item-name {
611
+ font-weight: 500;
612
+ }
613
+
614
+ .item-quantity {
615
+ color: #718096;
616
+ }
617
+
618
+ .modal-footer {
619
+ display: flex;
620
+ justify-content: flex-end;
621
+ gap: 10px;
622
+ margin-top: 20px;
623
+ }
624
+
625
+ /* Animaciones */
626
+ .fade-in {
627
+ animation: fadeIn 0.5s ease-in;
628
+ }
629
+
630
+ @keyframes fadeIn {
631
+ from { opacity: 0; }
632
+ to { opacity: 1; }
633
  }
634
  </style>
635
  </head>
636
+ <body>
637
+ <div class="container">
638
  <!-- Header -->
639
+ <header class="header">
640
+ <h1>Menú Saludable</h1>
641
+ <h2>Plan de 30 días para mayores de 50 años</h2>
642
+ <div class="header-line"></div>
643
  </header>
644
 
645
  <!-- Controls -->
646
+ <div class="controls">
647
+ <div class="controls-container">
648
+ <div class="filter-group">
649
+ <span class="filter-label">Filtrar por:</span>
650
+ <div class="filter-buttons">
651
+ <button id="filter-all" class="button button-all">Todas</button>
652
+ <button id="filter-breakfast" class="button button-breakfast">Desayunos</button>
653
+ <button id="filter-dinner" class="button button-dinner">Cenas</button>
654
  </div>
655
  </div>
656
+ <div class="filter-buttons">
657
+ <button id="generate-menu" class="button button-generate">
658
  <i class="fas fa-sync-alt"></i> Nuevo Menú
659
  </button>
660
+ <button id="shopping-list" class="button button-shopping">
661
  <i class="fas fa-shopping-basket"></i> Lista de Compra
662
  </button>
663
  </div>
664
+ <div class="filter-buttons">
665
+ <button id="export-pdf" class="button button-pdf">
666
  <i class="fas fa-file-pdf"></i> PDF
667
  </button>
668
+ <button id="export-csv" class="button button-csv">
669
  <i class="fas fa-file-csv"></i> CSV
670
  </button>
671
  </div>
 
673
  </div>
674
 
675
  <!-- Loading State -->
676
+ <div id="loading" class="loading">
677
  <div class="loading-spinner"></div>
678
+ <p class="loading-text">Generando menú saludable...</p>
679
  </div>
680
 
681
  <!-- Main Content -->
682
+ <div class="main-content">
683
  <!-- Calendar View -->
684
+ <div id="calendar-view" class="calendar">
685
+ <h3 class="calendar-title">Calendario del Menú</h3>
686
+ <div class="calendar-grid">
687
+ <div class="calendar-day-header">L</div>
688
+ <div class="calendar-day-header">M</div>
689
+ <div class="calendar-day-header">X</div>
690
+ <div class="calendar-day-header">J</div>
691
+ <div class="calendar-day-header">V</div>
692
+ <div class="calendar-day-header">S</div>
693
+ <div class="calendar-day-header">D</div>
694
  </div>
695
  <div id="calendar-days" class="calendar-grid">
696
  <!-- Calendar days will be populated here -->
697
  </div>
698
+ <div class="nutrition-summary">
699
+ <h4 class="nutrition-title">Resumen Nutricional</h4>
700
+ <div class="nutrition-card">
701
+ <div class="nutrition-item">
702
+ <span class="nutrition-label">Calorías promedio:</span>
703
+ <span id="avg-calories" class="nutrition-value">-</span>
704
  </div>
705
+ <div class="nutrition-item">
706
+ <span class="nutrition-label">Proteínas promedio:</span>
707
+ <span id="avg-protein" class="nutrition-value">-</span>
708
  </div>
709
+ <div class="nutrition-item">
710
+ <span class="nutrition-label">Balance nutricional:</span>
711
+ <span id="nutrition-score" class="nutrition-value">-</span>
712
  </div>
713
  </div>
714
  </div>
715
  </div>
716
 
717
  <!-- Recipes List -->
718
+ <div id="recipes-container" class="recipes-container">
719
+ <div id="no-recipes" class="no-recipes">
720
+ <i class="fas fa-utensils no-recipes-icon"></i>
721
+ <h3 class="no-recipes-title">No hay recetas cargadas</h3>
722
+ <p class="no-recipes-text">Haz clic en "Generar Menú" para comenzar</p>
723
  </div>
724
+ <div id="recipes-list" class="recipes-list">
725
  <!-- Recipe cards will be populated here -->
726
  </div>
727
  </div>
728
  </div>
729
 
730
  <!-- Shopping List Modal -->
731
+ <div id="shopping-modal" class="modal">
732
+ <div class="modal-content">
733
+ <div class="modal-header">
734
+ <h3 class="modal-title">Lista de la Compra</h3>
735
+ <button id="close-shopping-modal" class="close-modal">
736
  <i class="fas fa-times"></i>
737
  </button>
738
  </div>
739
  <div id="shopping-list-content">
740
+ <div class="shopping-empty">
741
+ <i class="fas fa-shopping-basket shopping-empty-icon"></i>
742
+ <p class="shopping-empty-text">Genera un menú primero para ver la lista de compra</p>
743
+ </div>
744
  </div>
745
+ <div class="modal-footer">
746
+ <button id="print-shopping-list" class="button button-generate">
747
  <i class="fas fa-print"></i> Imprimir
748
  </button>
749
+ <button id="export-shopping-pdf" class="button button-pdf">
750
  <i class="fas fa-file-pdf"></i> PDF
751
  </button>
752
  </div>
 
792
  shoppingListBtn.addEventListener('click', showShoppingList);
793
  exportPdfBtn.addEventListener('click', exportToPdf);
794
  exportCsvBtn.addEventListener('click', exportToCsv);
795
+ closeShoppingModal.addEventListener('click', () => shoppingModal.style.display = 'none');
796
  printShoppingListBtn.addEventListener('click', printShoppingList);
797
  exportShoppingPdfBtn.addEventListener('click', exportShoppingListToPdf);
798
  filterAllBtn.addEventListener('click', () => filterRecipes('all'));
 
806
  // Create 30 days (1 month)
807
  for (let i = 1; i <= 30; i++) {
808
  const dayElement = document.createElement('div');
809
+ dayElement.className = 'calendar-day';
810
  dayElement.textContent = i;
811
  dayElement.dataset.day = i;
812
 
813
  dayElement.addEventListener('click', () => {
814
  // Remove highlight from all days
815
+ document.querySelectorAll('.calendar-day').forEach(el => {
816
+ el.classList.remove('selected');
817
  });
818
 
819
  // Highlight selected day
820
+ dayElement.classList.add('selected');
821
  selectedDay = i;
822
 
823
  // Filter recipes for this day
 
830
 
831
  // Generate monthly menu
832
  async function generateMonthlyMenu() {
833
+ loading.style.display = 'flex';
834
+ noRecipes.style.display = 'none';
835
  recipesList.innerHTML = '';
836
 
837
  try {
 
862
  console.error('Error generating menu:', error);
863
  alert('Error al generar el menú. Por favor intenta nuevamente.');
864
  } finally {
865
+ loading.style.display = 'none';
866
  }
867
  }
868
 
 
893
 
894
  try {
895
  // Search for recipes
896
+ const response = await fetch(`${API_URL}?${params}`);
897
+ const data = await response.json();
898
 
899
+ if (data.hits.length === 0) {
900
  console.warn(`No recipes found for ${mealType}`);
901
  return null;
902
  }
903
 
904
+ const recipeData = data.hits[0].recipe;
905
 
906
  // Format recipe data for our app
907
  return {
 
963
  // Render recipes
964
  function renderRecipes(recipes) {
965
  if (recipes.length === 0) {
966
+ noRecipes.style.display = 'block';
967
  return;
968
  }
969
 
 
971
 
972
  recipes.forEach(recipe => {
973
  const recipeCard = document.createElement('div');
974
+ recipeCard.className = 'recipe-card fade-in';
975
  recipeCard.dataset.day = recipe.day;
976
  recipeCard.dataset.mealType = recipe.mealType;
977
 
978
  recipeCard.innerHTML = `
979
+ <div class="recipe-content">
980
+ <img class="recipe-image" src="${recipe.image}" alt="${recipe.title}" onerror="this.src='https://via.placeholder.com/400x300?text=Imagen+no+disponible'">
981
+ <div class="recipe-details">
982
+ <div class="recipe-header">
 
 
983
  <div>
984
+ <span class="recipe-tag ${recipe.mealType === 'breakfast' ? 'tag-breakfast' : 'tag-dinner'}">
 
985
  ${recipe.mealType === 'breakfast' ? 'Desayuno' : 'Cena'} - Día ${recipe.day}
986
  </span>
987
+ <h3 class="recipe-title">${recipe.title}</h3>
988
  </div>
989
+ <div class="recipe-servings">
990
+ <span>${recipe.servings} porciones</span>
991
+ <i class="fas fa-utensils"></i>
992
  </div>
993
  </div>
994
 
995
+ <div class="nutrition-badges">
996
+ <div class="nutrition-badge badge-calories">
997
  <i class="fas fa-fire"></i> ${recipe.nutrition.calories} kcal
998
  </div>
999
+ <div class="nutrition-badge badge-protein">
1000
  <i class="fas fa-dumbbell"></i> ${recipe.nutrition.protein}g proteína
1001
  </div>
1002
+ <div class="nutrition-badge badge-carbs">
1003
  <i class="fas fa-bread-slice"></i> ${recipe.nutrition.carbs}g carbos
1004
  </div>
1005
+ <div class="nutrition-badge badge-fat">
1006
  <i class="fas fa-oil-can"></i> ${recipe.nutrition.fat}g grasas
1007
  </div>
1008
  </div>
1009
 
1010
+ <div class="ingredients-section">
1011
+ <h4 class="ingredients-title">Ingredientes (${recipe.servings} porciones):</h4>
1012
+ <ul class="ingredients-list">
1013
  ${recipe.ingredients.map(ing =>
1014
+ `<li class="ingredient-item">
1015
+ <i class="fas fa-check-circle ingredient-icon"></i>
1016
  <span>${ing.text}</span>
1017
  </li>`
1018
  ).join('')}
1019
  </ul>
1020
  </div>
1021
 
1022
+ <div class="instructions-section">
1023
+ <h4 class="instructions-title">Instrucciones:</h4>
1024
+ <p class="instructions-text">Para ver las instrucciones completas, visita el enlace original de la receta.</p>
 
 
1025
  </div>
1026
 
1027
  ${recipe.sourceUrl ? `
1028
+ <div class="recipe-source">
1029
+ <span class="source-label">Fuente: </span>
1030
+ <a href="${recipe.sourceUrl}" target="_blank" class="source-link">
1031
  ${recipe.sourceName || 'Ver receta original'}
1032
  </a>
1033
  </div>
 
1068
  function showShoppingList() {
1069
  if (Object.keys(shoppingList).length === 0) {
1070
  shoppingListContent.innerHTML = `
1071
+ <div class="shopping-empty">
1072
+ <i class="fas fa-shopping-basket shopping-empty-icon"></i>
1073
+ <p class="shopping-empty-text">Genera un menú primero para ver la lista de compra</p>
1074
  </div>
1075
  `;
1076
  } else {
 
1099
 
1100
  sortedAisles.forEach(aisle => {
1101
  html += `
1102
+ <div class="aisle-section">
1103
+ <h4 class="aisle-title">
1104
+ <i class="fas fa-store-alt aisle-icon"></i>${aisle}
1105
  </h4>
1106
+ <ul class="shopping-list">
1107
  ${aisles[aisle].map(item => `
1108
+ <li class="shopping-item">
1109
+ <span class="item-name">${item.name}</span>
1110
+ <span class="item-quantity">${Math.round(item.amount * 10) / 10} ${item.unit}</span>
1111
  </li>
1112
  `).join('')}
1113
  </ul>
 
1118
  shoppingListContent.innerHTML = html;
1119
  }
1120
 
1121
+ shoppingModal.style.display = 'flex';
1122
  }
1123
 
1124
  // Helper function to capitalize first letter
 
1132
  const originalContent = document.body.innerHTML;
1133
 
1134
  document.body.innerHTML = `
1135
+ <div style="padding: 40px; font-family: Arial, sans-serif;">
1136
+ <h1 style="font-size: 24px; font-weight: bold; text-align: center; margin-bottom: 30px; color: #333;">
1137
+ Lista de la Compra
1138
+ </h1>
1139
  ${printContent}
1140
+ <div style="margin-top: 40px; text-align: center; font-size: 12px; color: #666;">
1141
  Generado por Menú Saludable para Mayores de 50
1142
  </div>
1143
  </div>
 
1155
  return;
1156
  }
1157
 
1158
+ alert('La exportación a PDF requiere la biblioteca jsPDF. Esta función está deshabilitada en esta versión.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1159
  }
1160
 
1161
  // Export to CSV
 
1192
  return;
1193
  }
1194
 
1195
+ alert('La exportación a PDF requiere la biblioteca jsPDF. Esta función está deshabilitada en esta versión.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1196
  }
1197
 
1198
  // Update nutrition summary
prompts.txt CHANGED
@@ -1,3 +1,4 @@
1
  Una aplicacion html y javascript en local sin node y con flexbox, que pida recetas bajas en calorias para 30 dias (comida y cena) para personas de mas de 50 años, el menu tiene que ser equilibrado, además tiene que alimentarse de un api de recetas de internet. la aplicacion mostrará la receta, los ingredientes y si es posible de donde las ha sacado, cada comida indicará las calorias en una tabla. Además generará la lista de la compra y tendra un boton para exportarlo a pdf otro para csv y otro mas para generar un nuevo menu mensual. Si usas una api que sea gratuita.
2
  puedes adaptarlo para usar el api de edamam.com y con mi api key edamam 1b8ad4ca
3
- puedes hacerlo con flexbox y arreglar el siguiente error:
 
 
1
  Una aplicacion html y javascript en local sin node y con flexbox, que pida recetas bajas en calorias para 30 dias (comida y cena) para personas de mas de 50 años, el menu tiene que ser equilibrado, además tiene que alimentarse de un api de recetas de internet. la aplicacion mostrará la receta, los ingredientes y si es posible de donde las ha sacado, cada comida indicará las calorias en una tabla. Además generará la lista de la compra y tendra un boton para exportarlo a pdf otro para csv y otro mas para generar un nuevo menu mensual. Si usas una api que sea gratuita.
2
  puedes adaptarlo para usar el api de edamam.com y con mi api key edamam 1b8ad4ca
3
+ puedes hacerlo con flexbox y arreglar el siguiente error:
4
+ NO USES tailwind USA FLEXBOX