{# @var recipe Nds\Recipe\Core\Content\Recipe\RecipeEntity #}
{% import "@NdsRecipeManager/rcpmanager/macro/elements.html.twig" as element %}
{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_content %}
{{ parent() }}
{% block recipe_detail_content %}
<div class="container-main container">
{% block recipe_detail_inner %}
<div class="recipe">
{% block recipe_detail_info %}
<div class="recipe-detail-content">
<div class="row recipe-detail-main mb-5">
{% block recipe_detail_image %}
<div class="col-lg-7 recipe-detail-media">
{% if recipe.media|length <= 0 and recipe.cover %}
{% set cover = [recipe.cover] %}
{% sw_include '@Storefront/storefront/element/cms-element-image-gallery.html.twig' with {
'mediaItems': cover,
'displayMode': 'contain',
'gutter': 5,
'minHeight': '430px',
'navigationArrows': 'inside',
'navigationDots': 'inside',
'galleryPosition': 'left',
} %}
{% elseif recipe.media|length > 0 %}
{% set allMedia = NdsRecipeGetAllMedia(recipe.media) %}
{% sw_include '@Storefront/storefront/element/cms-element-image-gallery.html.twig' with {
'mediaItems': allMedia,
'displayMode': 'contain',
'gutter': 5,
'minHeight': '430px',
'navigationArrows': 'inside',
'navigationDots': 'inside',
'galleryPosition': 'left',
} %}
{% else %}
<div class="recipe-image-placeholder">
{% sw_icon 'placeholder' style {
'size': 'fluid'
} %}
</div>
{% endif %}
</div>
{% endblock %}
{% block recipe_detail_description_info %}
<div class="col-lg-5">
{% block recipe_headline %}
<h1>{{ recipe.translated.name }}</h1>
{% if recipe.translated.subhead is defined %}
<h2 class="mb-4">{{ recipe.translated.subhead }}</h2>
{% endif %}
{% endblock %}
{% block recipe_source %}
<div class="recipe-source">
{{ "source"|trans|sw_sanitize }}: {{ app.request.uri }}
</div>
{% endblock %}
{% block recipe_infos %}
<div class="recipe-infos">
<div class="row">
{% if recipe.preparationTime is not empty %}
{% block recipe_info_time %}
<div class="col-4">
<div class="product-detail-configurator-group">
<div class="product-detail-configurator-group-title">
{{ "totalTime"|trans|sw_sanitize }}
</div>
<div class="product-detail-configurator-option">
{{ recipe.preparationTime }} {{ "minutes"|trans|sw_sanitize }}
</div>
</div>
</div>
{% endblock %}
{% endif %}
{% if recipe.difficulty is not empty %}
{% block recipe_info_difficulty %}
<div class="col-4">
<div class="product-detail-configurator-group">
<div class="product-detail-configurator-group-title">
{{ "difficulty"|trans|sw_sanitize }}
</div>
<div class="product-detail-configurator-option">
{{ recipe.difficulty.translated.name }}
</div>
</div>
</div>
{% endblock %}
{% endif %}
<div class="col-4 printer-icon">
{% block recipe_detail_print %}
<a onClick="window.print()" class="recipe-print">
<span class="mr-2">{% sw_icon('printer') %}</span>
{{ "print"|trans|sw_sanitize }}
</a>
{% endblock %}
</div>
</div>
</div>
{% endblock %}
{% if recipe.description %}
{% block recipe_description %}
<p>{{ recipe.translated.description|sw_sanitize }}</p>
{% endblock %}
{% endif %}
</div>
{% endblock %}
</div>
</div>
{% endblock %}
{% block recipe_product_detail_maincontent %}
<div class="product-detail-content">
{% block recipe_detail_ingredients_preperation %}
<div class="recipe-details row">
{% if recipe.ingredients.elements %}
{% block recipe_ingredients %}
<div class="recipe-ingredients col-md-6">
<h2 class="mb-4">{{ "ingredients"|trans|sw_sanitize }}</h2>
{% block recipe_ingredients_portion_calculator %}
{% if recipe.portionCalculatorActive %}
<template data-portion-calculator></template>
<div id="portionCalculator">
<label for="portionQuantity">
{{ 'portions'|trans|sw_sanitize }}
</label>
<input type="number" value="{{ recipe.portionQuantity }}" min="1" max="20" id="portionQuantity">
</div>
{% endif %}
{% endblock %}
{% block recipe_ingredients_table %}
<table class="table table-striped recipe-ingredients-table">
{% for ingredient in recipe.ingredients|sort((a, b) => a.sortKey <=> b.sortKey) %}
{{ element.ingredientTableRow(ingredient, recipe.portionQuantity) }}
{% endfor %}
</table>
{% set availableProducts = 0 %}
{% for ingredient in recipe.ingredients %}
{% if ingredient.product.active %}
{% set availableProducts = availableProducts + 1 %}
{% endif %}
{% endfor %}
{% if config('NdsRecipeManager.config.addAllProductsToCart') && (availableProducts > 0) %}
<form action="{{ path('frontend.checkout.line-item.add') }}" method="post" data-add-to-cart="true">
{{ sw_csrf('frontend.checkout.line-item.add') }}
{% for ingredient in recipe.ingredients %}
{% if ingredient.product.active %}
<input type="hidden" name="redirectTo" value="frontend.cart.offcanvas">
<input type="hidden" name="lineItems[{{ ingredient.product.id }}][id]" value="{{ ingredient.product.id }}">
<input type="hidden" name="lineItems[{{ ingredient.product.id }}][type]" value="product">
<input type="hidden" name="lineItems[{{ ingredient.product.id }}][referencedId]" value="{{ ingredient.product.id }}">
<input type="hidden" name="lineItems[{{ ingredient.product.id }}][stackable]" value="1">
<input type="hidden" name="lineItems[{{ ingredient.product.id }}][removable]" value="1">
<input type="hidden" name="lineItems[{{ ingredient.product.id }}][quantity]" value="1">
<input type="hidden" name="product-name" value="{{ ingredient.product.name }}">
{% endif %}
{% endfor %}
<button class="btn btn-primary btn-sm addAllToCart">
{% sw_icon 'cart' style {
'color': 'light',
'size' : 'xs'
} %}
{{ 'addAllProductsToCart'|trans|sw_sanitize }}
</button>
</form>
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% endif %}
{% if recipe.translated.preparation %}
{% block recipe_preperation %}
<div class="recipe-preparation col-md-6">
<h2 class="mb-4">{{ "preparation"|trans }}</h2>
<div class="preparation">
{{ recipe.translated.preparation|sw_sanitize }}
</div>
</div>
{% endblock %}
{% endif %}
</div>
{% endblock %}
{% block recipe_detail_nutritional_values %}
{% if recipe.hasNutritionalValues %}
<div class="product-detail-properties my-4">
<div class="col-md-10 col-lg-6 mx-0 px-0">
<h2 class="mb-4">{{ "nutritionalValues"|trans }}</h2>
{% block recipe_nutritional_values_table %}
<table class="table table-striped recipe-nutritional-values-table">
<tbody>
{% if recipe.energy is defined and recipe.energy|length > 0 %}
<tr>
<td class="nutritional-values-label">{{ "energy"|trans }}</td>
<td class="value">{{ recipe.energy|number_format(1, ',', '.') }} kJ<td>
</tr>
{% endif %}
{% if recipe.calories is defined and recipe.calories|length > 0 %}
<tr>
<td class="nutritional-values-label">{{ "calories"|trans }}</td>
<td class="value">{{ recipe.calories|number_format(1, ',', '.') }} kcal<td>
</tr>
{% endif %}
{% if recipe.protein is defined and recipe.protein|length > 0 %}
<tr>
<td class="nutritional-values-label">{{ "protein"|trans }}</td>
<td class="value">{{ recipe.protein|number_format(1, ',', '.') }} g<td>
</tr>
{% endif %}
{% if recipe.fat is defined and recipe.fat|length > 0 %}
<tr>
<td class="nutritional-values-label">{{ "fat"|trans }}</td>
<td class="value">{{ recipe.fat|number_format(1, ',', '.') }} g<td>
</tr>
{% endif %}
{% if recipe.carbohydrates is defined and recipe.carbohydrates|length > 0 %}
<tr>
<td class="nutritional-values-label">{{ "carbohydrates"|trans }}</td>
<td class="value">{{ recipe.carbohydrates|number_format(1, ',', '.') }} g<td>
</tr>
{% endif %}
</tbody>
</table>
{% endblock %}
</div>
</div>
{% endif %}
{% endblock %}
{% block recipe_detail_organization %}
<div class="recipe-organization row my-4">
<div class="col-md-8">
{% if (recipe.categories.elements or recipe.hasTags()) %}
<h2 class="mb-4">{{ "assignment"|trans }}</h2>
{% endif %}
<div class="row">
{% block recipe_assignment_category %}
{% if (recipe.categories.elements) %}
<div class="col-auto">
<div class="product-detail-configurator-group">
<div class="product-detail-configurator-group-title">
{{ "category"|trans }}
</div>
<div class="product-detail-configurator-options">
{{ element.categoryLinks(recipe) }}
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block recipe_assignment_tags %}
{% if recipe.hasTags() %}
<div class="col-auto">
<div class="product-detail-configurator-group">
<div class="product-detail-configurator-group-title">
{{ "tags"|trans }}
</div>
<div class="product-detail-configurator-options">
{{ element.tagLinks(recipe) }}
</div>
</div>
</div>
{% endif %}
{% endblock %}
</div>
{% block recipe_assignment_custom_fields %}
{% if recipe.customFields %}
<div class="product-detail-custom-fields">
{% for customField in recipe.customFields %}
<p>{{ customField }}</p>
{% endfor %}
</div>
{% endif %}
{% endblock %}
</div>
</div>
{% endblock %}
</div>
{% endblock %}
</div>
{% if recipe.hasRelatedRecipes %}
{% block recipe_related_recipes %}
<div class="relatedRecipes">
<h2>{{ "relatedRecipes"|trans }}</h2>
<div class="row">
{% for item in recipe.relatedRecipes %}
<div class="col-12 col-md-4 col-lg-3 my-4">
{% sw_include '@Storefront/rcpmanager/recipe/card/box.html.twig' with { item: item.relatedRecipe } %}
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% endblock %}
{% block base_body_script %}
{{ parent() }}
<script type="application/ld+json">
{{ schemaJson | raw }}
</script>
{% endblock %}