vendor/store.shopware.com/ndsrecipemanager/src/Resources/views/rcpmanager/page/detail.html.twig line 318

Open in your IDE?
  1. {# @var recipe Nds\Recipe\Core\Content\Recipe\RecipeEntity #}
  2. {% import "@NdsRecipeManager/rcpmanager/macro/elements.html.twig" as element %}
  3. {% sw_extends '@Storefront/storefront/base.html.twig' %}
  4. {% block base_content %}
  5.     {{ parent() }}
  6.     {% block recipe_detail_content %}
  7.         <div class="container-main container">
  8.             {% block recipe_detail_inner %}
  9.                 <div class="recipe">
  10.                     {% block recipe_detail_info %}
  11.                         <div class="recipe-detail-content">
  12.                             <div class="row recipe-detail-main mb-5">
  13.                                 {% block recipe_detail_image %}
  14.                                     <div class="col-lg-7 recipe-detail-media">
  15.                                         {% if recipe.media|length <= 0 and recipe.cover %}
  16.                                             {% set cover = [recipe.cover] %}
  17.                                             {% sw_include '@Storefront/storefront/element/cms-element-image-gallery.html.twig' with {
  18.                                                 'mediaItems': cover,
  19.                                                 'displayMode': 'contain',
  20.                                                 'gutter': 5,
  21.                                                 'minHeight': '430px',
  22.                                                 'navigationArrows': 'inside',
  23.                                                 'navigationDots': 'inside',
  24.                                                 'galleryPosition': 'left',
  25.                                             } %}
  26.                                         {% elseif recipe.media|length > 0 %}
  27.                                             {% set allMedia = NdsRecipeGetAllMedia(recipe.media) %}
  28.                                             {% sw_include '@Storefront/storefront/element/cms-element-image-gallery.html.twig' with {
  29.                                                 'mediaItems': allMedia,
  30.                                                 'displayMode': 'contain',
  31.                                                 'gutter': 5,
  32.                                                 'minHeight': '430px',
  33.                                                 'navigationArrows': 'inside',
  34.                                                 'navigationDots': 'inside',
  35.                                                 'galleryPosition': 'left',
  36.                                             } %}
  37.                                         {% else %}
  38.                                             <div class="recipe-image-placeholder">
  39.                                                 {% sw_icon 'placeholder' style {
  40.                                                     'size': 'fluid'
  41.                                                 } %}
  42.                                             </div>
  43.                                         {% endif %}
  44.                                     </div>
  45.                                 {% endblock %}
  46.                                 {% block recipe_detail_description_info %}
  47.                                     <div class="col-lg-5">
  48.                                         {% block recipe_headline %}
  49.                                             <h1>{{ recipe.translated.name }}</h1>
  50.                                             {% if recipe.translated.subhead is defined %}
  51.                                                 <h2 class="mb-4">{{ recipe.translated.subhead }}</h2>
  52.                                             {% endif %}
  53.                                         {% endblock %}
  54.                                         {% block recipe_source %}
  55.                                             <div class="recipe-source">
  56.                                                 {{ "source"|trans|sw_sanitize }}: {{ app.request.uri }}
  57.                                             </div>
  58.                                         {% endblock %}
  59.                                         {% block recipe_infos %}
  60.                                             <div class="recipe-infos">
  61.                                                 <div class="row">
  62.                                                     {% if recipe.preparationTime is not empty %}
  63.                                                         {% block recipe_info_time %}
  64.                                                             <div class="col-4">
  65.                                                                 <div class="product-detail-configurator-group">
  66.                                                                     <div class="product-detail-configurator-group-title">
  67.                                                                         {{ "totalTime"|trans|sw_sanitize }}
  68.                                                                     </div>
  69.                                                                     <div class="product-detail-configurator-option">
  70.                                                                         {{ recipe.preparationTime }} {{ "minutes"|trans|sw_sanitize }}
  71.                                                                     </div>
  72.                                                                 </div>
  73.                                                             </div>
  74.                                                         {% endblock %}
  75.                                                     {% endif %}
  76.                                                     {% if recipe.difficulty is not empty %}
  77.                                                         {% block recipe_info_difficulty %}
  78.                                                             <div class="col-4">
  79.                                                                 <div class="product-detail-configurator-group">
  80.                                                                     <div class="product-detail-configurator-group-title">
  81.                                                                         {{ "difficulty"|trans|sw_sanitize }}
  82.                                                                     </div>
  83.                                                                     <div class="product-detail-configurator-option">
  84.                                                                         {{ recipe.difficulty.translated.name }}
  85.                                                                     </div>
  86.                                                                 </div>
  87.                                                             </div>
  88.                                                         {% endblock %}
  89.                                                     {% endif %}
  90.                                                     <div class="col-4 printer-icon">
  91.                                                         {% block recipe_detail_print %}
  92.                                                             <a onClick="window.print()" class="recipe-print">
  93.                                                                 <span class="mr-2">{%  sw_icon('printer') %}</span>
  94.                                                                 {{ "print"|trans|sw_sanitize }}
  95.                                                             </a>
  96.                                                         {% endblock %}
  97.                                                     </div>
  98.                                                 </div>
  99.                                             </div>
  100.                                         {% endblock %}
  101.                                         {% if recipe.description %}
  102.                                             {% block recipe_description %}
  103.                                                 <p>{{ recipe.translated.description|sw_sanitize }}</p>
  104.                                             {% endblock %}
  105.                                         {% endif %}
  106.                                     </div>
  107.                                 {% endblock %}
  108.                             </div>
  109.                         </div>
  110.                     {% endblock %}
  111.                     {% block recipe_product_detail_maincontent %}
  112.                         <div class="product-detail-content">
  113.                             {% block recipe_detail_ingredients_preperation %}
  114.                                 <div class="recipe-details row">
  115.                                     {% if recipe.ingredients.elements %}
  116.                                         {% block recipe_ingredients %}
  117.                                             <div class="recipe-ingredients col-md-6">
  118.                                                 <h2 class="mb-4">{{ "ingredients"|trans|sw_sanitize }}</h2>
  119.                                                 {% block recipe_ingredients_portion_calculator %}
  120.                                                     {% if recipe.portionCalculatorActive %}
  121.                                                         <template data-portion-calculator></template>
  122.                                                         <div id="portionCalculator">
  123.                                                             <label for="portionQuantity">
  124.                                                                 {{ 'portions'|trans|sw_sanitize }}
  125.                                                             </label>
  126.                                                             <input type="number" value="{{ recipe.portionQuantity }}" min="1" max="20" id="portionQuantity">
  127.                                                         </div>
  128.                                                     {% endif %}
  129.                                                 {% endblock %}
  130.                                                 {% block recipe_ingredients_table %}
  131.                                                     <table class="table table-striped recipe-ingredients-table">
  132.                                                         {% for ingredient in recipe.ingredients|sort((a, b) => a.sortKey <=> b.sortKey) %}
  133.                                                             {{ element.ingredientTableRow(ingredient, recipe.portionQuantity) }}
  134.                                                         {% endfor %}
  135.                                                     </table>
  136.                                                     {% set availableProducts = 0 %}
  137.                                                     {% for ingredient in recipe.ingredients %}
  138.                                                         {% if ingredient.product.active %}
  139.                                                             {% set availableProducts = availableProducts + 1 %}
  140.                                                         {% endif %}
  141.                                                     {% endfor %}
  142.                                                     {% if config('NdsRecipeManager.config.addAllProductsToCart') && (availableProducts > 0) %}
  143.                                                         <form action="{{ path('frontend.checkout.line-item.add') }}" method="post" data-add-to-cart="true">
  144.                                                             {{ sw_csrf('frontend.checkout.line-item.add') }}
  145.                                                             {% for ingredient in recipe.ingredients %}
  146.                                                                 {% if ingredient.product.active %}
  147.                                                                     <input type="hidden" name="redirectTo" value="frontend.cart.offcanvas">
  148.                                                                     <input type="hidden" name="lineItems[{{ ingredient.product.id }}][id]" value="{{ ingredient.product.id }}">
  149.                                                                     <input type="hidden" name="lineItems[{{ ingredient.product.id }}][type]" value="product">
  150.                                                                     <input type="hidden" name="lineItems[{{ ingredient.product.id }}][referencedId]" value="{{ ingredient.product.id }}">
  151.                                                                     <input type="hidden" name="lineItems[{{ ingredient.product.id }}][stackable]" value="1">
  152.                                                                     <input type="hidden" name="lineItems[{{ ingredient.product.id }}][removable]" value="1">
  153.                                                                     <input type="hidden" name="lineItems[{{ ingredient.product.id }}][quantity]" value="1">
  154.                                                                     <input type="hidden" name="product-name" value="{{ ingredient.product.name }}">
  155.                                                                 {% endif %}
  156.                                                             {% endfor %}
  157.                                                             <button class="btn btn-primary btn-sm addAllToCart">
  158.                                                                 {% sw_icon 'cart' style {
  159.                                                                     'color': 'light',
  160.                                                                     'size' : 'xs'
  161.                                                                 } %}
  162.                                                                 {{ 'addAllProductsToCart'|trans|sw_sanitize }}
  163.                                                             </button>
  164.                                                         </form>
  165.                                                     {% endif %}
  166.                                                 {% endblock %}
  167.                                             </div>
  168.                                         {% endblock %}
  169.                                     {% endif %}
  170.                                     {% if recipe.translated.preparation %}
  171.                                         {% block recipe_preperation %}
  172.                                             <div class="recipe-preparation col-md-6">
  173.                                                 <h2 class="mb-4">{{ "preparation"|trans }}</h2>
  174.                                                 <div class="preparation">
  175.                                                     {{ recipe.translated.preparation|sw_sanitize }}
  176.                                                 </div>
  177.                                             </div>
  178.                                         {% endblock %}
  179.                                     {% endif %}
  180.                                 </div>
  181.                             {% endblock %}
  182.                             {% block recipe_detail_nutritional_values %}
  183.                                 {% if recipe.hasNutritionalValues %}
  184.                                     <div class="product-detail-properties my-4">
  185.                                         <div class="col-md-10 col-lg-6 mx-0 px-0">
  186.                                             <h2 class="mb-4">{{ "nutritionalValues"|trans }}</h2>
  187.                                             {% block recipe_nutritional_values_table %}
  188.                                                 <table class="table table-striped recipe-nutritional-values-table">
  189.                                                     <tbody>
  190.                                                     {% if recipe.energy is defined and recipe.energy|length > 0 %}
  191.                                                         <tr>
  192.                                                             <td class="nutritional-values-label">{{ "energy"|trans }}</td>
  193.                                                             <td class="value">{{ recipe.energy|number_format(1, ',', '.') }} kJ<td>
  194.                                                         </tr>
  195.                                                     {% endif %}
  196.                                                     {% if recipe.calories is defined and recipe.calories|length > 0 %}
  197.                                                         <tr>
  198.                                                             <td class="nutritional-values-label">{{ "calories"|trans }}</td>
  199.                                                             <td class="value">{{ recipe.calories|number_format(1, ',', '.') }} kcal<td>
  200.                                                         </tr>
  201.                                                     {% endif %}
  202.                                                     {% if recipe.protein is defined and recipe.protein|length > 0 %}
  203.                                                         <tr>
  204.                                                             <td class="nutritional-values-label">{{ "protein"|trans }}</td>
  205.                                                             <td class="value">{{ recipe.protein|number_format(1, ',', '.') }} g<td>
  206.                                                         </tr>
  207.                                                     {% endif %}
  208.                                                     {% if recipe.fat is defined and recipe.fat|length > 0 %}
  209.                                                         <tr>
  210.                                                             <td class="nutritional-values-label">{{ "fat"|trans }}</td>
  211.                                                             <td class="value">{{ recipe.fat|number_format(1, ',', '.') }} g<td>
  212.                                                         </tr>
  213.                                                     {% endif %}
  214.                                                     {% if recipe.carbohydrates is defined and recipe.carbohydrates|length > 0 %}
  215.                                                         <tr>
  216.                                                             <td class="nutritional-values-label">{{ "carbohydrates"|trans }}</td>
  217.                                                             <td class="value">{{ recipe.carbohydrates|number_format(1, ',', '.') }} g<td>
  218.                                                         </tr>
  219.                                                     {% endif %}
  220.                                                     </tbody>
  221.                                                 </table>
  222.                                             {% endblock %}
  223.                                         </div>
  224.                                     </div>
  225.                                 {% endif %}
  226.                             {% endblock %}
  227.                             {% block recipe_detail_organization %}
  228.                                 <div class="recipe-organization row my-4">
  229.                                     <div class="col-md-8">
  230.                                         {% if (recipe.categories.elements or recipe.hasTags()) %}
  231.                                             <h2 class="mb-4">{{ "assignment"|trans }}</h2>
  232.                                         {% endif %}
  233.                                         <div class="row">
  234.                                             {% block recipe_assignment_category %}
  235.                                                 {% if (recipe.categories.elements) %}
  236.                                                     <div class="col-auto">
  237.                                                         <div class="product-detail-configurator-group">
  238.                                                             <div class="product-detail-configurator-group-title">
  239.                                                                 {{ "category"|trans }}
  240.                                                             </div>
  241.                                                             <div class="product-detail-configurator-options">
  242.                                                                 {{ element.categoryLinks(recipe) }}
  243.                                                             </div>
  244.                                                         </div>
  245.                                                     </div>
  246.                                                 {% endif %}
  247.                                             {% endblock %}
  248.                                             {% block recipe_assignment_tags %}
  249.                                                 {% if recipe.hasTags() %}
  250.                                                     <div class="col-auto">
  251.                                                         <div class="product-detail-configurator-group">
  252.                                                             <div class="product-detail-configurator-group-title">
  253.                                                                 {{ "tags"|trans }}
  254.                                                             </div>
  255.                                                             <div class="product-detail-configurator-options">
  256.                                                                 {{ element.tagLinks(recipe) }}
  257.                                                             </div>
  258.                                                         </div>
  259.                                                     </div>
  260.                                                 {% endif %}
  261.                                             {% endblock %}
  262.                                         </div>
  263.                                         {% block recipe_assignment_custom_fields %}
  264.                                             {% if recipe.customFields %}
  265.                                                 <div class="product-detail-custom-fields">
  266.                                                     {% for customField in recipe.customFields %}
  267.                                                         <p>{{ customField }}</p>
  268.                                                     {% endfor %}
  269.                                                 </div>
  270.                                             {% endif %}
  271.                                         {% endblock %}
  272.                                     </div>
  273.                                 </div>
  274.                             {% endblock %}
  275.                         </div>
  276.                     {% endblock %}
  277.                 </div>
  278.                 {% if recipe.hasRelatedRecipes %}
  279.                     {% block recipe_related_recipes %}
  280.                         <div class="relatedRecipes">
  281.                             <h2>{{ "relatedRecipes"|trans }}</h2>
  282.                             <div class="row">
  283.                                 {% for item in recipe.relatedRecipes %}
  284.                                     <div class="col-12 col-md-4 col-lg-3 my-4">
  285.                                         {% sw_include '@Storefront/rcpmanager/recipe/card/box.html.twig' with { item: item.relatedRecipe } %}
  286.                                     </div>
  287.                                 {% endfor %}
  288.                             </div>
  289.                         </div>
  290.                     {% endblock %}
  291.                 {% endif %}
  292.             {% endblock %}
  293.         </div>
  294.     {% endblock %}
  295. {% endblock %}
  296. {% block base_body_script %}
  297.     {{ parent() }}
  298.     <script type="application/ld+json">
  299.         {{ schemaJson | raw }}
  300.     </script>
  301. {% endblock %}