{% if Product is defined %}
{% set RecommendRecipe = repository('Plugin\\Recipe\\Entity\\Recipe').getRecommendRecipe(Product) %}
{% set recommend_recipe_style = 'related-recipe' %}
{% else %}
{% set RecommendRecipe = repository('Plugin\\Recipe\\Entity\\Recipe').getRecommendRecipe() %}
{% set recommend_recipe_style = 'recommend-recipe' %}
{% endif %}
<link rel="stylesheet" href="{{ asset('Recipe/assets/default/css/recipe.css' , 'plugin') }}">
<script>
$(window).on('load', function () {
//レシピ
const recipe = new Swiper(".recipe-swiper", {
loop: true,
slidesPerView: 1,
breakpoints: {
769: {
slidesPerView: 2
},
1024: {
slidesPerView: 3
}
},
spaceBetween: 18,
autoHeight: true,
navigation: {
nextEl: ".p-recipe .swiper-button-next",
prevEl: ".p-recipe .swiper-button-prev",
},
});
});
</script>
<section class="p-section p-recipe {{ recommend_recipe_style }}">
<div class="inner">
{% if recommend_recipe_title is defined and recommend_recipe_title is not null %}
<h2 class="p-title icon-top"><span>{{ recommend_recipe_title }}</span></h2>
{% else %}
<h2 class="p-title icon-top"><span>おすすめレシピ</span></h2>
{% endif %}
{% if recommend_recipe_text is defined and recommend_recipe_text is not null %}
<p class="p-text">{{ recommend_recipe_text }}</p>
{% endif %}
<div class="recipe-slide">
<div class="swiper recipe-swiper">
<div class="swiper-wrapper">
{% for Recipe in RecommendRecipe %}
<div class="swiper-slide">
<div class="p-recipe-box">
<a href="{{ url('recipe_detail', {'id': Recipe.id}) }}">
<div class="recipe-head">
{% if
Product is defined and
Recipe.RecipeBadge is defined and
Recipe.RecipeBadge.name is defined and
Recipe.RecipeBadge.name is not null and
Recipe.RecipeBadge.filename != '' %}
<div class="recipe-badge">
<img
src="{{ asset(Recipe.RecipeBadge.filename|no_image_product, 'save_image') }}"
alt="{{ Recipe.RecipeBadge.name }}">
</div>
{% endif %}
<img src="{{ asset(Recipe.mainListImage|no_image_product, 'save_image') }}" alt="">
</div>
<div class="recipe-body">
<h3 class="recipe-name">{{ Recipe.name }}</h3>
{% if Recipe.RelatedProducts|length > 0 %}
<p class="recipe-product">使用した商品:{{ Recipe.RelatedProducts[0].ChildProduct.name }}</p>
{% endif %}
<div class="recipe-wrap">
<p class="recipe-time"><span>{{ Recipe.minute }}</span>分</p>
<p class="recipe-calorie"><span>{{ Recipe.energy }}</span>kcal</p>
</div>
<ul class="recipe-tag-list">
{% for tag in Recipe.tags %}
<li class="recipe-tag-item">♯{{ tag.name }}</li>
{% endfor %}
</ul>
{% if Product is defined %}
<ul class="material-list">
{% for material in Recipe.materials %}
<li class="material-item">{{ material.name }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
{% if Product is not defined or Product is null %}
<div class="p-button orange"><a href="{{ url('recipe') }}">もっと見る</a></div>
{% endif %}
</div>
</section>