198 lines
10 KiB
PHP

<?php
require_once(INCLUDES_PATH . '/Const/recipes.php');
the_header(
$context['recipe']->field_title,
'This is a single recipe page where you can view the details of the recipe, including ingredients, instructions, and more.',
'recipe',
[
['keywords', 'terms, use, conditions']
]
);
?>
<div id="recipe-id" hidden><?= $context['recipe']->get_id() ?></div>
<div class="container">
<div class="single-recipe">
<div class="single-recipe-info">
<div class="single-recipe-info__image">
<img src="<?= $context['recipe']->get_image_url(); ?>"
alt="<?php echo $context['recipe']->field_title; ?>">
</div>
<div class="single-recipe-info__details">
<div class="single-recipe-title">
<h1 class="title"><?php echo $context['recipe']->field_title; ?></h1>
</div>
<div class="single-recipe-data">
<div class="single-recipe-data__item">
<span class="data-name">Category: </span>
<span class="data"><?= $context['recipe']->category_name ?></span>
</div>
<div class="single-recipe-data__item">
<span class="data-name">Author: </span>
<span class="data"><?= $context['author']->field_username ?></span>
</div>
<div class="single-recipe-data__item">
<span class="data-name">Estimated Price: </span>
<span class="data"><?php echo $context['recipe']->get_price(); ?></span>
</div>
<div class="single-recipe-data__item">
<span class="data-name">Time To Make: </span>
<span class="data"><?php echo $context['recipe']->get_time(); ?></span>
</div>
<div class="single-recipe-data__item">
<span class="data-name">Ingredients: </span>
<span class="data"><?= join(", ", $context['ingredients']) ?></span>
</div>
<div class="single-recipe-data__item">
<span class="data-name">Date Created: </span>
<span class="data"><?php echo $context['recipe']->field_created_at; ?></span>
</div>
</div>
<div class="button-ctrl">
<select class="hidden" name="daily-meal-select" id="daily-meal-day">
<?php foreach (DAYS_OF_WEEK as $day): ?>
<option value="<?= $day ?>"><?= ucfirst($day) ?></option>
<?php endforeach; ?>
<option value="remove">Remove From List</option>
</select>
<div class="day-select-wrapper">
<div class="hover-anim">
<button type="button" href="#" id="day-select" class="btn btn-primary day-select">Add to
list</button>
<i class="fa-solid fa-list select-icon"></i>
</div>
<div id="custom-select-dropdown" class="custom-select-dropdown hidden">
<?php foreach (DAYS_OF_WEEK as $day): ?>
<div class="dropdown-item hover-anim" data-value="<?= $day ?>">
<?= ucfirst($day) ?>
</div>
<?php endforeach; ?>
<div class="dropdown-item hover-anim" data-value="remove">Remove From List</div>
</div>
</div>
<div class="small-btns">
<button id="favorite-btn"
class="btn btn-secondary btn-small hover-anim <?= $context['recipe']->is_in_favorite ? 'active' : '' ?>"
title="Add To Favorites">
<i
class="<?= $context['recipe']->is_in_favorite ? 'fa-solid' : 'fa-regular' ?> fa-heart"></i>
</button>
<a class="btn btn-secondary btn-small hover-anim"
href="<?php the_permalink('recipes:export-pdf', [$context['recipe']->get_id()]); ?>"
target="_blank" title="Export As PDF">
<i class="fa-solid fa-download"></i>
</a>
<button class="btn btn-secondary btn-small hover-anim" id="qr-btn" title="Get QR Code">
<i class="fa-solid fa-qrcode"></i>
</button>
</div>
<div id="overlay" class="hidden"></div>
<div class="qr-popup hidden">
<div id="qrcode"></div>
<a id="downloadLink" class="btn btn-primary hover-anim" href="#" download="recipe-qr.png">
Download QR Code
</a>
</div>
</div>
</div>
</div>
<div class="single-recipe-content">
<div class="single-instructions">
<h2 class="title">Instructions</h2>
<?= $context['recipe']->get_html_instruction(); ?>
</div>
<div class="single-ingredients">
<h2 class="title">Ingredients</h2>
<table class="ingredients-table">
<thead>
<tr>
<th>Name</th>
<th>Count</th>
</tr>
</thead>
<tbody>
<?php
foreach ($context['ingredients'] as $ing) {
?>
<tr>
<td><?= $ing; ?></td>
<td><?= $ing->get_count(); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<div class="single-recipe-reviews">
<h2 class="title">Reviews</h2>
<h3 class="rating">Average Rating: 4.5 <i class="fa-regular fa-star"></i></h3>
<div class="reviews">
<div class="review-list">
<h4 class="subtitle">All Reviews</h4>
<div class="review">
<span class="review-title"> <i class="fa-solid fa-star"></i> 5 Divine disc of
deliciousness!</span>
<div class="review-body">
Blessings of Aqua-sama upon you, fellow foodies! As a proud and very sane member of the Axis
Cult, I recently partook in a holy culinary experience that rivaled even the sacred waters
of the Blue Lake: a homemade pepperoni and mushroom pizza!
The moment I laid eyes on that glorious golden crust, I knew—Aqua-sama herself must have
guided my ovens temperature dial! The cheese was melted with such heavenly grace,
stretching with every bite like the ribbons of our goddesss divine garments. The pepperoni?
Spicy circles of salvation! And the mushrooms—earthy little blessings sent straight from the
soil Aqua purifies daily!
The crust had the perfect balance of crispy edge and fluffy soul. It crackled like the
laughter of a cultist pranking a stubborn Eris follower (teehee~). Each bite sang praises in
my mouth: “Axis! Axis! AXIS!!”
Would I recommend this pizza? Of course! Id even offer it as tribute at the next festival
in Aquas honor. Try it yourself and bask in the savory enlightenment. And remember: if it
tastes weird, just pour holy water on it. Or beer. Aqua would approve either way.
Rating: 5 out of 5 Axis Blessings!(Any lower would be heresy.)
</div>
<div class="single-review-meta">
<div class="review-meta__user meta">
<i class="fa-regular fa-user"></i> GreenDavid004
</div>
<div class="review-meta__date meta"><?= date("d.m.Y"); ?></div>
</div>
</div>
</div>
<div class="review-form">
<h4 class="subtitle">Your Review</h4>
<form id="review-form" class="review-form__form" method="post" action="#">
<div class="rating-selection">
<label for="rating-select">Choose rating: </label>
<select name="rating-select" id="rating select">
<option value="0">Rating</option>
<option value="1">1 Star</option>
<option value="2">2 Star </option>
<option value="3">3 Star</option>
<option value="4">4 Star</option>
<option value="5">5 Star</option>
</select>
</div>
<div class="input">
<input type="text" name="review-title" id="review-title-input" placeholder="Review Title"
required>
</div>
<textarea name="review-body-input" id="review-body-input" placeholder="Write your review here"></textarea>
<button type="submit" class="btn btn-primary hover-anim">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php the_footer(array(
ASSETS_PATH . '/js/single.js',
)); ?>