<?php
require_once APPS_PATH . '/Recipes/components.php';
require_once(INCLUDES_PATH . '/Const/recipes.php');

the_header(
    'Daily Meals',
    'What do you want to eat today?',
    'daily-meals-page',
    [
        ['keywords', 'recipes, cooking, food, cuisine'],

    ]
);
?>
<div class="container">
<div class="daily-recipes">
<?php
foreach ($context['weeks'] as $day => $recipe_prefetches) {
?>
    <?php if(!empty($recipe_prefetches)): ?>
    <div class="daily-meals">
        <h2 class="title">Your Menu for <?= ucfirst($day) ?></h2>
        <div class="daily-meals-grid">
            
            <?php 
            foreach ($recipe_prefetches as $recipe_pref) {
                the_product_recipes_item($recipe_pref['origin'], $recipe_pref['relations']);
            }
            ?>
        </div>
    </div>
    <?php else: ?>
        <div class="daily-meals">
        <h2 class="title">No meals added for <?= ucfirst($day); ?></h2>
        <p class="no-daily-meals-msg">You have not added any recipes for <?= ucfirst($day);?>, please go to the catalog and add recipes.</p>
    </div>
    <?php endif; ?>
<?php
}
?>
</div>
</div>
<?php the_footer(); ?>